Submission #300052

#TimeUsernameProblemLanguageResultExecution timeMemory
300052kevleeGame (IOI14_game)C++17
100 / 100
518 ms25340 KiB
#include <bits/stdc++.h> #include "game.h" using namespace std; #define FOR(i, a, b) for (int i = (a); i <= (b); i++) int comp[1505], sz[1505], link[1505][1505]; int n; void initialize(int N) { n = N; FOR(i, 1, n) comp[i] = i, sz[i] = 1; FOR(i, 1, n) { FOR(j, 1, n) { if (i != j) link[i][j] = 1; } } return; } int hasEdge(int u, int v) { u++; v++; if (link[comp[u]][comp[v]] == 1) { FOR(i, 1, n) { if (comp[i] != comp[v] && comp[i] != comp[u] && comp[i] == i) { link[comp[i]][comp[v]] += link[comp[i]][comp[u]]; link[comp[v]][comp[i]] += link[comp[i]][comp[u]]; } } sz[comp[v]] += sz[comp[u]]; int tmp = comp[u]; FOR(i, 1, n) { if (comp[i] == tmp) comp[i] = comp[v]; } return 1; } link[comp[u]][comp[v]]--; link[comp[v]][comp[u]]--; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...