# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
426197 | erekle | Connecting Supertrees (IOI20_supertrees) | C++17 | 331 ms | 47564 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;
// DSU
int root(int i, vector<int> &parent) {
return parent[i] < 0 ? i : (parent[i] = root(parent[i], parent));
}
bool unite(int i, int j, vector<int> &parent) {
i = root(i, parent), j = root(j, parent);
if (i == j) return false;
if (parent[i] < parent[j]) swap(i, j);
parent[j] += parent[i];
parent[i] = j;
return true;
}
int construct(vector<vector<int>> p) {
int n = p.size();
vector<vector<int>> answer(n, vector<int>(n));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
if (p[i][j] == 3) return 0;
}
}
vector<int> parent(n, -1);
for (int i = 0; i < n; ++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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |