Codeforces Round #694 DIV1 D問題/DIV2 F問題 - Strange Housing

Source

Codeforces Round #694 DIV1 D問題 (1500pt)
Codeforces Round #694 DIV2 F問題 (2500pt)
Problem description

問題概要

省略

解法

省略

cLayversion 20210103-1)のコード

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

//no-unlocked
int N, M, A[3d5], B[3d5];
graph g;
int dist[3d5], q[3d5], qs, qe, dame[3d5];
int ress, res[3d5];
{
  REP(rd_int()){
    rd(N,M,(A--,B--)(M));
    g.setEdge(N,M,A,B);
    rep(i,N) dist[i] = dame[i] = -1;
    dist[0] = 0;
    qs = qe = 0;
    q[qe++] = 0;
    while(qs < qe){
      i = q[qs++];
      rep[g.edge[i]](j,g.es[i]){
        if(dist[j] != -1 || dame[j] == dist[i] + 1) continue;
        dist[j] = dist[i] + 1;
        q[qe++] = j;
        if(dist[j]%2==0) rep[g.edge[j]](k,g.es[j]) dame[k] = dist[j];
      }
    }
    if(qe < N) wt("NO"), continue;
    wt("YES");
    ress = 0;
    rep(i,N) if(dist[i]%2==0) res[ress++] = i;
    wt(ress);
    wt(res(ress)+1);
  }
}

Current time: 2024年04月19日17時20分32秒
Last modified: 2021年01月08日22時27分13秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF694 CF_DIV1_D CF_DIV2_F
トップページに戻る

Logged in as: unknown user (not login)

ログイン: