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"
using namespace std;
int par[1505],con[1505],b[1505];
void initialize(int n) {
for(int i=1;i<=n;i++)
{
par[i]=i;
con[i]=1;
b[i]=n-1;
}
}
int find_par(int vr)
{
if(vr==par[vr]) return vr;
return par[vr]=find_par(vr);
}
int hasEdge(int u, int v) {
u++;v++;
u=find_par(u);b[u]--;
v=find_par(v);b[v]--;
if(u==v) return 1;
if(b[u]==0 || b[v]==0)
{
par[v]=u;
con[v]+=con[u];con[u]=con[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... |