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"
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |