# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
433654 | magmag | Connecting Supertrees (IOI20_supertrees) | C++17 | 300 ms | 26076 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 "supertrees.h"
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
struct UF {
vi p, rnk;
int nsets;
UF(int n) {
p = vi(n);
for (int i = 0; i < n; ++i)p[i] = i;
rnk = vi(n);
nsets = n;
}
int parent(int i) {
if (p[i] == i)return i;
return p[i] = parent(p[i]);
}
bool check(int a, int b) {
return parent(a) == parent(b);
}
void join(int a, int b) {
if (check(a,b))return;
nsets--;
a = parent(a);
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |