제출 #72593

#제출 시각아이디문제언어결과실행 시간메모리
72593vex게임 (IOI14_game)C++14
0 / 100
3 ms688 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) { unite(u,v); return 1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...