Submission #27999

#TimeUsernameProblemLanguageResultExecution timeMemory
27999zoomswkGame (IOI14_game)C++14
100 / 100
723 ms18764 KiB
#include "game.h" int cnt[1505][1505]; int id[1505]; int sz[1505]; int N; void initialize(int n) { N = n; for(int i=0; i<n; i++) sz[i] = 1, id[i] = i; return; } int hasEdge(int u, int v){ u = id[u], v = id[v]; if(cnt[u][v] == sz[u]*sz[v]-1){ // merge v into u for(int i=0; i<N; i++) cnt[i][u] += cnt[i][v]; for(int i=0; i<N; i++) cnt[u][i] += cnt[v][i]; for(int i=0; i<N; i++) if(id[i] == v) id[i] = u; sz[u] += sz[v]; return 1; } cnt[u][v]++, cnt[v][u]++; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...