제출 #72613

#제출 시각아이디문제언어결과실행 시간메모리
72613vex게임 (IOI14_game)C++14
0 / 100
3 ms432 KiB
#include <bits/stdc++.h> #define maxn 1505 using namespace std; int n; int sz[maxn],p[maxn],br[maxn][maxn]; void initialize(int N) { n=N; for(int i=0;i<n;i++) { sz[i]=1; p[i]=i; } for(int i=0;i<n;i++)for(int j=0;j<n;j++)br[i][j]=0; } int fnd(int x) { if(x==p[x])return x; return p[x]=fnd(p[x]); } int hasEdge(int u,int v) { u=fnd(u); v=fnd(v); if(u==v)return 1; if(sz[u]<sz[v])swap(u,v); if(br[u][v]+1==sz[u]*sz[v]) { sz[u]+=sz[v]; p[v]=p[u]; for(int i=0;i<n-1;i++) { if(i==u)continue; br[u][i]+=br[v][i]; br[i][u]+=br[v][i]; } return 1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...