# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
432448 | dreezy | Connecting Supertrees (IOI20_supertrees) | C++17 | 331 ms | 24132 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;
const int maxn = 1e3 + 5;
#define pb push_back
struct UnionFind{
int parent[maxn], height[maxn];
void init(int n){
for(int i =0; i<n; i++) parent[i] =i;
memset(height, 0, sizeof height);
}
int root(int n){
if(parent[n]!= n)
parent[n] = root(parent[n]);
return parent[n];
}
bool same(int n1, int n2){
return root(n1) == root(n2);
}
void join(int n1, int n2){
int r1 = root(n1);
int r2 = root(n2);
if(height[r1]> height[r2]){
parent[r2] = r1;
# | 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... |