# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
928616 | 2024-02-16T19:16:23 Z | OAleksa | Game (IOI14_game) | C++14 | 18 ms | 36444 KB |
#include "game.h" #include <bits/stdc++.h> using namespace std; const int N = 1569; int n, p[N], sz[N], c[N][N]; int root(int v) { if (p[v] == v) return v; return p[v] = root(p[v]); } void initialize(int n1) { n = n1; for (int i = 0;i < n;i++) { p[i] = i, sz[i] = 1; } for (int i = 0;i < n;i++) { for (int j = 0;j < n;j++) { if (i == j) continue; c[i][j] = 1; } } } int hasEdge(int u, int v) { int a = root(u); int b = root(v); if (a == b || c[a][b] > 1) return 1; --c[a][b], --c[b][a]; if (sz[a] < sz[b]) swap(a, b); p[b] = a; sz[a] += sz[b]; for (int i = 0;i < n;i++) { if (i == a || i == b) continue; c[a][i] += c[b][i]; c[i][a] += c[b][i]; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 17 ms | 36440 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 17 ms | 36444 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 18 ms | 36444 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |