This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "game.h"
const int N = 2000;
int p[N], c[N], cnt[N][N], pn;
void initialize(int n) {
pn = n;
for(int i=0; i<pn; i++){
p[i] = i;
c[i] = 1;
}
}
int hasEdge(int u, int v) {
u = p[u];
v = p[v];
cnt[u][v]++;
cnt[v][u]++;
if(cnt[u][v] == c[u]*c[v]){
c[u] += c[v];
for(int i=0; i<pn; i++){
if(p[i] == v)
p[i] = u;
cnt[u][i] += cnt[v][i];
cnt[i][u] += cnt[i][v];
}
return 1;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |