제출 #759352

#제출 시각아이디문제언어결과실행 시간메모리
759352DJeniUp게임 (IOI14_game)C++17
0 / 100
1 ms340 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...