제출 #77317

#제출 시각아이디문제언어결과실행 시간메모리
77317MvC게임 (IOI14_game)C++14
0 / 100
3 ms952 KiB
#pragma GCC optimize("O3") #include<bits/stdc++.h> #define rc(x) return cout<<x<<endl,0 #define pb push_back #define in insert #define er erase #define fd find #define fr first #define sc second typedef long long ll; const ll INF=0x3f3f3f3f3f3f3f3f; const ll llinf=(1LL<<61); const int inf=(1<<30); const int nmax=2e3+50; const int mod=1e9+7; using namespace std; int i,n,p[nmax],sz[nmax],s[nmax]; int fnd(int x) { if(p[x]==x)return x; return p[x]=fnd(p[x]); } void uni(int x,int y) { if(x!=y) { if(sz[x]<sz[y])swap(x,y); p[y]=x; sz[x]+=sz[y]; s[x]+=s[y]-2; } else s[x]-=2; } void initialize(int n) { for(int i=1;i<=n;i++) { p[i]=i; sz[i]=1; s[i]=n-1; } } int hasEdge(int u, int v) { u++,v++; int x=fnd(u),y=fnd(v); if(x==y || min(s[x],s[y])==1) { uni(x,y); return 1; } s[x]--,s[y]--; return 0; } /*int main() { //freopen("sol.in","r",stdin); //freopen("sol.out","w",stdout); ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0); return 0; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...