제출 #234682

#제출 시각아이디문제언어결과실행 시간메모리
234682Fischer게임 (IOI14_game)C++14
0 / 100
5 ms384 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 1510 + 10; int rnk[maxn]; int link[maxn]; int cnt[maxn][maxn]; int n; int get(int x) { if (x == link[x]) { return x; } return link[x] = get(link[x]); } void initialize(int n) { ::n = n; for (int i = 1; i <= n; ++i) { link[i] = i; rnk[i] = 1; } } int hasEdge(int u, int v) { u = get(u); v = get(v); if (u == v) return 1; cnt[u][v] = cnt[v][u] += 1; if (cnt[u][v] < rnk[u] * rnk[v]) return 0; if (rnk[u] < rnk[v]) swap(u, v); rnk[u] += rnk[v]; link[v] = u; for (int i = 1; i <= n; ++i) { cnt[v][i] = cnt[u][i] = cnt[i][u] + cnt[i][v]; } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...