保存されている過去のバージョンの一覧

2020年12月05日15時21分08秒

Codeforces Round #688 DIV2 E問題 - Dog Snacks

Source

Codeforces Round #688 DIV2 E問題 (2500pt)
Problem description

問題概要

省略

解法

省略

cLayversion 20201205-1)のコード

C++に変換後のコードはこちら

//no-unlocked
int N, A[2d5], B[2d5];
graph g;
int cur[2d5];
{
  REP(rd_int()){
    int i, k, m1, m2, mn, res, ok;
    rd(N,(A--,B--)(N-1));
    g.setEdgeRootedTree(N,N-1,A,B,0,1);
    res = bsearch_min[int,x,1,N-1][
      ok = 1;
      rrep(i,N){
        if(g.es[i]==0) cur[i] = 0, continue;
        if(g.es[i]==1){
          cur[i] = cur[g.edge[i][0]] + 1;
          if(cur[i] > x) ok = 0, break;
          continue;
        }
        m1 = m2 = 0;
        mn = int_inf;
        rep[g.edge[i]](k,g.es[i]){
          mn <?= cur[k];
          m2 >?= cur[k];
          if(m1 < m2) swap(m1, m2);
        }
        if(m1 + 1 >= x) cur[i] = max(m1 + 1, m2 + 2);
        else            cur[i] = mn + 1;
        if(cur[i] > x) ok = 0, break;
      }
    ](ok);
    wt(res);
  }
}

Current time: 2024年03月29日06時15分28秒
Last modified: 2020年12月05日15時21分08秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF688 CF_DIV2_E
トップページに戻る

Logged in as: unknown user (not login)

ログイン: