# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
931303 | _fractal | Game (IOI14_game) | C++14 | 1 ms | 2396 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N = 1501;
int p[N], sz[N];
int cnt[N][N], n;
int get(int v){
return (p[v] == v ? v : (p[v] = get(p[v])));
}
void unite(int a, int b){
a = get(a);
b = get(b);
if(a == b)
return;
if(sz[a] > sz[b])
swap(a, b);
p[a] = b;
sz[b] += sz[a];
for(int i = 1; i <= n; i++){
if (p[i] == i && i != b && i != a) {
cnt[b][i] += cnt[a][i];
cnt[i][b] += cnt[a][i];
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |