Submission #693765

#TimeUsernameProblemLanguageResultExecution timeMemory
693765T0p_Game (IOI14_game)C++14
15 / 100
1 ms352 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; int n; int pa[1500], sz[1500], cnt[1500][1500]; int fp(int u) { return pa[u] = (u == pa[u]) ? u : fp(pa[u]); } void initialize(int N) { n = N; for (int i=0 ; i<n ; i++) { pa[i] = i; sz[i] = 1; } } int hasEdge(int u, int v) { u = fp(u); v = fp(v); if (u == v) return 0; if (u > v) swap(u, v); cnt[u][v] += 1; if (cnt[u][v] != sz[u] * sz[v]) return 0; for (int i=0 ; i<n ; i++) cnt[u][i] += cnt[v][i]; pa[v] = u; sz[u] += sz[v]; return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...