# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
927701 | 2024-02-15T08:52:29 Z | Rifal | Connecting Supertrees (IOI20_supertrees) | C++14 | 173 ms | 23376 KB |
#include "supertrees.h" #include <bits/stdc++.h> #define endl '\n' using namespace std; const int M = 1e3 + 4; int typ[M]; vector<int> v1[M], v2[M]; vector<vector<int>> gr; bool egd[M][M]; int cnt = 1; int construct(std::vector<std::vector<int>> p) { bool ok = true; int n = p.size(); for(int i = 0; i < n; i++) { if(typ[i] == 0) { typ[i] = cnt; v1[cnt].push_back(i); v2[cnt].push_back(i); cnt++; } for(int j = 0; j < n; j++) { if(j == i) continue; if(p[i][j] == 1) { if(typ[j] == 0) { v1[typ[i]].push_back(j); typ[j] = typ[i]; } else if(typ[j] != typ[i]){ ok = false; break; } } else if(p[i][j] == 2){ if(typ[j] == 0) { v2[typ[i]].push_back(j); typ[j] = typ[i]; } else if(typ[j] != typ[i]){ ok = false; break; } } else if(p[i][j] == 0 && typ[i] == typ[j]) { ok = false; break; } } if(!ok) break; } if(ok) { for(int i = 1; i < cnt; i++) { if(v1[i].size() > 1) { for(int j = 1; j < v1[i].size(); j++) { egd[v1[i][0]][v1[i][j]] = 1; egd[v1[i][j]][v1[i][0]] = 1; } } if(v2[i].size() > 1) { for(int j = 1; j < v2[i].size(); j++) { egd[v2[i][j]][v2[i][j-1]] = 1; egd[v2[i][j-1]][v2[i][j]] = 1; } int siz = v2[i].size(); egd[v2[i][0]][v2[i][siz-1]] = 1; egd[v2[i][siz-1]][v2[i][0]] = 1; } } for(int i = 0; i < n; i++) { // cout << 'i' << i << endl; vector<int> cur; for(int j = 0; j < n; j++) { //cout << 'j' << ' ' << j << ' ' << egd[i][j] << endl; cur.push_back(egd[i][j]); } gr.push_back(cur); } build(gr); return 1; } else { return 0; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 6 ms | 1372 KB | Output is correct |
7 | Correct | 152 ms | 23124 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 6 ms | 1372 KB | Output is correct |
7 | Correct | 152 ms | 23124 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 10 ms | 1368 KB | Output is correct |
13 | Correct | 150 ms | 22080 KB | Output is correct |
14 | Correct | 0 ms | 344 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 4 ms | 600 KB | Output is correct |
17 | Correct | 63 ms | 8276 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 344 KB | Output is correct |
20 | Correct | 46 ms | 6228 KB | Output is correct |
21 | Correct | 151 ms | 23124 KB | Output is correct |
22 | Correct | 152 ms | 23376 KB | Output is correct |
23 | Correct | 173 ms | 23116 KB | Output is correct |
24 | Correct | 150 ms | 22408 KB | Output is correct |
25 | Correct | 61 ms | 8268 KB | Output is correct |
26 | Correct | 60 ms | 8280 KB | Output is correct |
27 | Correct | 155 ms | 23124 KB | Output is correct |
28 | Correct | 155 ms | 22724 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 452 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Incorrect | 0 ms | 348 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 | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 38 ms | 6236 KB | Output is correct |
5 | Correct | 152 ms | 23100 KB | Output is correct |
6 | Correct | 155 ms | 23120 KB | Output is correct |
7 | Correct | 158 ms | 23124 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 39 ms | 6548 KB | Output is correct |
10 | Correct | 150 ms | 23124 KB | Output is correct |
11 | Correct | 150 ms | 23104 KB | Output is correct |
12 | Correct | 153 ms | 23124 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 344 KB | Output is correct |
15 | Correct | 1 ms | 348 KB | Output is correct |
16 | Incorrect | 38 ms | 6268 KB | Too many ways to get from 23 to 253, should be 1 found no less than 2 |
17 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 6 ms | 1372 KB | Output is correct |
7 | Correct | 152 ms | 23124 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 10 ms | 1368 KB | Output is correct |
13 | Correct | 150 ms | 22080 KB | Output is correct |
14 | Correct | 0 ms | 344 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 4 ms | 600 KB | Output is correct |
17 | Correct | 63 ms | 8276 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 344 KB | Output is correct |
20 | Correct | 46 ms | 6228 KB | Output is correct |
21 | Correct | 151 ms | 23124 KB | Output is correct |
22 | Correct | 152 ms | 23376 KB | Output is correct |
23 | Correct | 173 ms | 23116 KB | Output is correct |
24 | Correct | 150 ms | 22408 KB | Output is correct |
25 | Correct | 61 ms | 8268 KB | Output is correct |
26 | Correct | 60 ms | 8280 KB | Output is correct |
27 | Correct | 155 ms | 23124 KB | Output is correct |
28 | Correct | 155 ms | 22724 KB | Output is correct |
29 | Correct | 1 ms | 348 KB | Output is correct |
30 | Correct | 0 ms | 452 KB | Output is correct |
31 | Correct | 0 ms | 344 KB | Output is correct |
32 | Incorrect | 0 ms | 348 KB | Answer gives possible 1 while actual possible 0 |
33 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 6 ms | 1372 KB | Output is correct |
7 | Correct | 152 ms | 23124 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 10 ms | 1368 KB | Output is correct |
13 | Correct | 150 ms | 22080 KB | Output is correct |
14 | Correct | 0 ms | 344 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 4 ms | 600 KB | Output is correct |
17 | Correct | 63 ms | 8276 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 344 KB | Output is correct |
20 | Correct | 46 ms | 6228 KB | Output is correct |
21 | Correct | 151 ms | 23124 KB | Output is correct |
22 | Correct | 152 ms | 23376 KB | Output is correct |
23 | Correct | 173 ms | 23116 KB | Output is correct |
24 | Correct | 150 ms | 22408 KB | Output is correct |
25 | Correct | 61 ms | 8268 KB | Output is correct |
26 | Correct | 60 ms | 8280 KB | Output is correct |
27 | Correct | 155 ms | 23124 KB | Output is correct |
28 | Correct | 155 ms | 22724 KB | Output is correct |
29 | Correct | 1 ms | 348 KB | Output is correct |
30 | Correct | 0 ms | 452 KB | Output is correct |
31 | Correct | 0 ms | 344 KB | Output is correct |
32 | Incorrect | 0 ms | 348 KB | Answer gives possible 1 while actual possible 0 |
33 | Halted | 0 ms | 0 KB | - |