int pa[1505];
int cnt[1505];
int m;
int find(int x){
return pa[x] = (pa[x] == x ? x : find(pa[x]));
}
void initialize(int n){
m = n;
for(int i=0; i<=n; i++) pa[i] = i;
}
int hasEdge(int u, int v){
cnt[u]++;
cnt[v]++;
if(cnt[u] == m-1 || cnt[v] == m-1){
if(find(u) != find(v)){
pa[u] = v;
return 0;
}
return 1;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
9884 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
9884 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
9884 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |