#include"game.h"
#include<bits/stdc++.h>
#ifdef juggernaut
#include"grader.cpp"
#endif
using namespace std;
int par[1505],sz[1505],a[1505];
int fin(int v){
return v==par[v]?v:par[v]=fin(par[v]);
}
void initialize(int n){
for(int i=0;i<n;i++){
par[i]=i;
sz[i]=1;
a[i]=n-1;
}
}
void unite(int a,int b){
if(sz[a]<sz[b])swap(a,b);
par[b]=a;
sz[a]+=sz[b];
::a[a]+=::a[b];
}
int hasEdge(int a,int b){
a=fin(a);
b=fin(b);
::a[a]--;
::a[b]--;
if(min(::a[a],::a[b])==0){
unite(a,b);
return 1;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
292 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |