Submission #72591

#TimeUsernameProblemLanguageResultExecution timeMemory
72591vexGame (IOI14_game)C++14
0 / 100
3 ms412 KiB
#include <bits/stdc++.h> #define maxn 1505 using namespace std; int n; int sz[maxn],p[maxn]; int uk=0; void initialize(int N) { n=N; for(int i=0;i<n;i++) { sz[i]=1; p[i]=i; } } int fnd(int x) { if(x==p[x])return x; p[x]=fnd(p[x]); return p[x]; } bool same(int x,int y) { return fnd(x)==fnd(y); } void unite(int x,int y) { x=fnd(x); y=fnd(y); if(sz[x]<sz[y])swap(x,y); sz[x]+=sz[y]; p[y]=x; } int hasEdge(int u,int v) { if(same(u,v))return 0; u=fnd(u); v=fnd(v); if(sz[u]+sz[v]<n)return 1; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...