제출 #759171

#제출 시각아이디문제언어결과실행 시간메모리
759171Dan4Life게임 (IOI14_game)C++17
0 / 100
1 ms312 KiB
#include <iostream> using namespace std; int n, p[2010], sz[2010]; int findSet(int i){return i==p[i]?i:p[i]=findSet(p[i]);} void unionSet(int i, int j){ int x = findSet(i), y = findSet(j); if(x==y) return; if(sz[x]<sz[y]) swap(x,y); p[y] = x; sz[x]+=sz[y]; } void initialize(int N){ n = N; for(int i =0; i < N; i++) p[i]=i,sz[i]=1; } bool hasEdge(int u, int v){ int cnt = 0; for(int i = 0; i < n; i++) if(findSet(i)==u) for(int j = 0; j < n; j++) if(findSet(j)==v) cnt++; return cnt>1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...