# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
373499 | Matteo_Verz | Connecting Supertrees (IOI20_supertrees) | C++17 | 273 ms | 24300 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;
vector <vector <int>> answer;
vector <int> viz;
vector <int> countroot;
vector <int> roots;
bitset <1001> isroot;
bool ok = true;
void Solve_Component(int node, vector <vector <int>> &p, int comp) {
int n = p.size();
vector <int> realnodes;
for(int i = 0; i < n; i++)
if(p[node][i] > 0 || i == node) {
viz[i] = comp; // mark each node as part of the component
realnodes.push_back(i); // we keep a vector with only the nodes in the component
}
for(int i : realnodes) {
for(int j = 0; j < n; j++)
if(p[i][j] == 0 && p[node][j] != 0) { // if there is path from i to j, from j to k, but not from i to k
ok = false;
return;
} else if(p[i][j] != 0 && p[node][j] == 0) { // same shit
ok = false;
return;
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... |