# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1160897 | JahonaliX | Game (IOI14_game) | C++20 | 0 ms | 328 KiB |
#include <bits/stdc++.h>
using namespace std;
struct dsu {
int n;
vector<int> p, c, f;
dsu() {}
dsu(int m) {
n = m;
p.assign(n, 0);
c.assign(n, 1);
f.assign(n, 0);
iota(p.begin(), p.end(), 0);
}
int find(int x) {
if (x == p[x]) return x;
return p[x] = find(p[x]);
}
void merge(int a, int b) {
p[b] = a;
f[a] = f[a] + f[b] - c[a] * c[b] * 2;
c[a] += c[b];
}
};
int n, p, k;
dsu d;
void initialize(int N) { n = k = N, d = dsu(n), p = n * (n - 1) / 2; }
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |