# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1084740 | 2024-09-06T20:53:53 Z | an22inkle | 슈퍼트리 잇기 (IOI20_supertrees) | C++17 | 136 ms | 24148 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 || (part[i] > -1 && part[j] > -1)) 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); part[i] = part[j] = lines.size() - 1; } } } 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]] == 0) return 0; } // std::cout << line[i] << ' '; if (i != line.size() - 1) ans[line[i]][line[i+1]] = ans[line[i + 1]][line[i]] = 1; } } build(ans); return 1; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 6 ms | 1372 KB | Output is correct |
7 | Correct | 136 ms | 23940 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 6 ms | 1372 KB | Output is correct |
7 | Correct | 136 ms | 23940 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 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 | 5 ms | 1400 KB | Output is correct |
13 | Correct | 111 ms | 24072 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 3 ms | 860 KB | Output is correct |
17 | Correct | 63 ms | 13996 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 30 ms | 6312 KB | Output is correct |
21 | Correct | 129 ms | 24148 KB | Output is correct |
22 | Correct | 114 ms | 24144 KB | Output is correct |
23 | Correct | 120 ms | 23924 KB | Output is correct |
24 | Correct | 111 ms | 23888 KB | Output is correct |
25 | Incorrect | 114 ms | 23940 KB | Answer gives possible 1 while actual possible 0 |
26 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Answer gives possible 1 while actual possible 0 |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 344 KB | Too few ways to get from 0 to 1, should be 2 found 1 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 6 ms | 1372 KB | Output is correct |
7 | Correct | 136 ms | 23940 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 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 | 5 ms | 1400 KB | Output is correct |
13 | Correct | 111 ms | 24072 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 3 ms | 860 KB | Output is correct |
17 | Correct | 63 ms | 13996 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 30 ms | 6312 KB | Output is correct |
21 | Correct | 129 ms | 24148 KB | Output is correct |
22 | Correct | 114 ms | 24144 KB | Output is correct |
23 | Correct | 120 ms | 23924 KB | Output is correct |
24 | Correct | 111 ms | 23888 KB | Output is correct |
25 | Incorrect | 114 ms | 23940 KB | Answer gives possible 1 while actual possible 0 |
26 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 6 ms | 1372 KB | Output is correct |
7 | Correct | 136 ms | 23940 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 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 | 5 ms | 1400 KB | Output is correct |
13 | Correct | 111 ms | 24072 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 3 ms | 860 KB | Output is correct |
17 | Correct | 63 ms | 13996 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 30 ms | 6312 KB | Output is correct |
21 | Correct | 129 ms | 24148 KB | Output is correct |
22 | Correct | 114 ms | 24144 KB | Output is correct |
23 | Correct | 120 ms | 23924 KB | Output is correct |
24 | Correct | 111 ms | 23888 KB | Output is correct |
25 | Incorrect | 114 ms | 23940 KB | Answer gives possible 1 while actual possible 0 |
26 | Halted | 0 ms | 0 KB | - |