# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
794216 | 2023-07-26T10:55:16 Z | 12345678 | Connecting Supertrees (IOI20_supertrees) | C++17 | 162 ms | 22160 KB |
#include "supertrees.h" #include <vector> #include <bits/stdc++.h> using namespace std; int id[1005], t; vector<vector<int>> d(1005); bool can=1; int construct(std::vector<std::vector<int>> p) { int n = p.size(); std::vector<std::vector<int>> answer; for (int i = 0; i < n; i++) { std::vector<int> row; row.resize(n); answer.push_back(row); } for (int i=0; i<n; i++) for (int j=0; j<n; j++) if (p[i][j]!=p[j][i]) can=0; if (!can)return 0; for (int i=0; i<n; i++) { for (int j=i+1; j<n; j++) { if (p[i][j]) { if (!id[i]&&!id[j]) id[i]=id[j]=++t, d[t].push_back(i), d[t].push_back(j); else if (!id[i]) id[i]=id[j], d[id[j]].push_back(i); else if (!id[j]) id[j]=id[i], d[id[i]].push_back(j); } } } for (int i=1; i<=t; i++) { sort(d[i].begin(), d[i].end()); for (auto x:d[i]) { for (auto y:d[i]) { if (!p[x][y]) can=0; } } if (!can) break; for (int j=0; j<d[i].size()-1; j++) answer[d[i][j]][d[i][j+1]]=answer[d[i][j+1]][d[i][j]]=1; } if (can) { build(answer); return 1; } else return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 7 ms | 1108 KB | Output is correct |
7 | Correct | 161 ms | 22160 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 7 ms | 1108 KB | Output is correct |
7 | Correct | 161 ms | 22160 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 6 ms | 1108 KB | Output is correct |
13 | Correct | 155 ms | 22056 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 3 ms | 724 KB | Output is correct |
17 | Correct | 71 ms | 12064 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 39 ms | 5696 KB | Output is correct |
21 | Correct | 156 ms | 22044 KB | Output is correct |
22 | Correct | 160 ms | 22064 KB | Output is correct |
23 | Correct | 162 ms | 22056 KB | Output is correct |
24 | Correct | 154 ms | 21964 KB | Output is correct |
25 | Incorrect | 154 ms | 22060 KB | Answer gives possible 1 while actual possible 0 |
26 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Answer gives possible 1 while actual possible 0 |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Too few ways to get from 0 to 1, should be 2 found 1 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 7 ms | 1108 KB | Output is correct |
7 | Correct | 161 ms | 22160 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 6 ms | 1108 KB | Output is correct |
13 | Correct | 155 ms | 22056 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 3 ms | 724 KB | Output is correct |
17 | Correct | 71 ms | 12064 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 39 ms | 5696 KB | Output is correct |
21 | Correct | 156 ms | 22044 KB | Output is correct |
22 | Correct | 160 ms | 22064 KB | Output is correct |
23 | Correct | 162 ms | 22056 KB | Output is correct |
24 | Correct | 154 ms | 21964 KB | Output is correct |
25 | Incorrect | 154 ms | 22060 KB | Answer gives possible 1 while actual possible 0 |
26 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 7 ms | 1108 KB | Output is correct |
7 | Correct | 161 ms | 22160 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 6 ms | 1108 KB | Output is correct |
13 | Correct | 155 ms | 22056 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 3 ms | 724 KB | Output is correct |
17 | Correct | 71 ms | 12064 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 39 ms | 5696 KB | Output is correct |
21 | Correct | 156 ms | 22044 KB | Output is correct |
22 | Correct | 160 ms | 22064 KB | Output is correct |
23 | Correct | 162 ms | 22056 KB | Output is correct |
24 | Correct | 154 ms | 21964 KB | Output is correct |
25 | Incorrect | 154 ms | 22060 KB | Answer gives possible 1 while actual possible 0 |
26 | Halted | 0 ms | 0 KB | - |