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"
using namespace std;
typedef int ll;
ll p[1507],s[1507],f[1507];
ll n,m,g;
ll P(ll x){
if(p[x]!=x)p[x]=P(p[x]);
return p[x];
}
void A(ll x,ll y){
if(rand()%2)swap(x,y);
x=P(x);
y=P(y);
p[y]=x;
s[x]+=s[y];
return ;
}
void initialize(int N) {
n=N;
for(int i=0;i<n;i++){
p[i]=i;
}
return ;
}
int hasEdge(int u, int v) {
s[u]++;
s[v]++;
ll fl=0;
//cout<<u<<" "<<v<<" "<<s[u]<<" "<<s[v]<<" ";
if(s[u]>0 && f[s[u]]==0){
f[s[u]]=1;
s[v]--;
s[u]=-1000000;
fl=1;
}
if(s[v]>0 && f[s[v]]==0){
f[s[v]]=1;
s[u]--;
s[v]=-1000000;
fl=1;
}
//cout<<s[u]<<" "<<s[v]<<endl;
return fl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |