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

2019年10月06日04時50分28秒

Codeforces Round #589 DIV2 D問題 - Complete Tripartite

Source

Codeforces Round #589 DIV2 D問題 (1750pt)
Problem description

問題概要

省略

解法

省略

cLayversion 20191006-1)のコード

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

//no-unlocked
int N, M, A[3d5], B[3d5];
int res[1d5], sz[4], vis[1d5];
{
  int con = 0;
  graph g;
  rd(N,M,(A--,B--)(M));
  g.setEdge(N,M,A,B);

  rep(i,N) if(g.es[i]==0) wt(-1), return 0;
  rep(i,N) sortA(g.es[i], g.edge[i]);

  rep(i,N) if(res[i]==0){
    con++;
    if(con > 3) wt(-1), return 0;
    res[i] = con;
    rep(j,i+1,N) if(g.es[j] == g.es[i]){
      rep(k,g.es[i]) if(g.edge[i][k] != g.edge[j][k]) break;
      if(k < g.es[i]) continue;
      res[j] = con;
    }
  }
  if(con != 3) wt(-1), return 0;

  rep(i,N) sz[res[i]]++;
  rep(i,N) if(g.es[i] != N - sz[res[i]]) wt(-1), return 0;

  wt(res(N));
}

Current time: 2024年04月19日16時04分57秒
Last modified: 2019年10月06日04時50分28秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF589 CF_Div2_D
トップページに戻る

Logged in as: unknown user (not login)

ログイン: