This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
int N,par[1551];
void initialize(int n){
N=n;
for(int i=0; i<n; i++) par[i]=i;
}
int root(int u){
return par[u]=(u==par[u])?u:root(par[u]);
}
int join(int u,int v){
int a=root(u),b=root(v);
if(a!=b){
par[a]=b;
N--;
}
return a!=b;
}
int hasEdge(int u,int v){
if(N==2) return 0;
return join(u,v);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |