Submission #234684

#TimeUsernameProblemLanguageResultExecution timeMemory
234684FischerGame (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[i][u] = 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...