Submission #16201

#TimeUsernameProblemLanguageResultExecution timeMemory
16201CodingBugGame (IOI14_game)C++98
100 / 100
496 ms18684 KiB
#include "game.h" #define M 1500 int u[M+1],m[M+1]; int a[M+1][M+1],n; void initialize(int _n) { n=_n; for(int i=0;i<n;i++){ u[i]=i; m[i]=1; } } int getroot(int x){ return u[x]==x ? x : u[x]=getroot(u[x]); } int hasEdge(int p, int q) { int i,x=getroot(p),y=getroot(q); a[x][y]++; a[y][x]++; if(a[x][y]==m[x]*m[y]){ for(i=0;i<n;i++){ a[x][i]+=a[y][i]; a[i][x]+=a[i][y]; } m[x]+=m[y]; u[y]=x; return 1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...