# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
319959 | eriksuenderhauf | Connecting Supertrees (IOI20_supertrees) | C++17 | 283 ms | 24420 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;
int par[1005], inTree[1005];
vector<int> cyc[1005], tree[1005];
int qry(int x) { return x == par[x] ? x : par[x] = qry(par[x]); }
void join(int x, int y) { par[qry(x)] = qry(y); }
int construct(vector<vector<int>> p) {
auto check_connectivity = [&](int n) {
iota(par, par+n, 0);
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
if (p[i][j] != 0)
join(i, j);
for (int i = 0; i < n; i++)
for (int j = i+1; j < n; j++)
if (p[i][j] == 0 && qry(i) == qry(j))
return 0;
return 1;
};
auto connect = [&](int n, int t) {
iota(par, par+n, 0);
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
if (p[i][j] == t)
join(i, j);
};
int n = p.size();
# | 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... |