# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
301757 | 2020-09-18T07:33:44 Z | SOIVIEONE | Connecting Supertrees (IOI20_supertrees) | C++14 | 1 ms | 384 KB |
#include "supertrees.h" #include <vector> #include <bits/stdc++.h> using namespace std; int ota[222222]; int find(int x) { return (ota[x] == x ? x : ota[x] = find(ota[x])); } void unite(int x, int y) { x = find(x); y = find(y); ota[y] = x; } int construct(std::vector<std::vector<int>> p) { int n = p.size(); std::vector<std::vector<int>> a; for (int i = 0; i < n; i++) { std::vector<int> row; row.resize(n); a.push_back(row); } for(int i = 0; i < n; i++) { for(int j = 0; j < n; j ++) { if(p[i][j]) { unite(i, j); } } } for(int i = 0; i < n; i ++) { for(int j = 0; j < n; j ++) { int otai = find(i); int otaj = find(j); if(((otai^otaj) && p[i][j]) || !(otai^otaj) && !p[i][j]) return 0; a[i][j] = (otai==otaj); } } build(a); return 1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | b[0][0] is not 0 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | b[0][0] is not 0 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 256 KB | Answer gives possible 0 while actual possible 1 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 256 KB | Answer gives possible 0 while actual possible 1 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | b[0][0] is not 0 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | b[0][0] is not 0 |
2 | Halted | 0 ms | 0 KB | - |