# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1084736 | 2024-09-06T20:41:07 Z | an22inkle | Connecting Supertrees (IOI20_supertrees) | C++17 | 1 ms | 600 KB |
#include<bits/stdc++.h> #include "supertrees.h" using pair = std::array<int, 2>; using ll = long long; int construct(std::vector<std::vector<int>> p) { int n = p.size(); std::vector<std::vector<int>> ans(n, std::vector<int>(n)), lines; std::vector<int> part(n, -1); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i == j) continue; if (p[i][j] == 0) continue; if (part[i] > -1) lines[part[i]].push_back(j), part[j] = part[i]; else if (part[j] > -1) lines[part[j]].push_back(i), part[i] = part[j]; else { lines.push_back({}); lines.back().push_back(i); lines.back().push_back(j); } } } for (auto line : lines) { for (int i = 0; i < line.size(); i++) { for (int j = i+1; j < line.size(); j++) { if (p[line[i]][line[j]] == 1) return 0; } if (i != line.size() - 1) ans[line[i]][line[i+1]] = 1; } } build(ans); return 1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 600 KB | Output is correct |
2 | Incorrect | 1 ms | 600 KB | Answer gives possible 0 while actual possible 1 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 600 KB | Output is correct |
2 | Incorrect | 1 ms | 600 KB | Answer gives possible 0 while actual possible 1 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 344 KB | Answer gives possible 1 while actual possible 0 |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Incorrect | 1 ms | 344 KB | Answer gives possible 0 while actual possible 1 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 600 KB | Output is correct |
2 | Incorrect | 1 ms | 600 KB | Answer gives possible 0 while actual possible 1 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 600 KB | Output is correct |
2 | Incorrect | 1 ms | 600 KB | Answer gives possible 0 while actual possible 1 |
3 | Halted | 0 ms | 0 KB | - |