# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
721939 | 2023-04-11T09:00:31 Z | danikoynov | 슈퍼트리 잇기 (IOI20_supertrees) | C++14 | 225 ms | 31952 KB |
#include "supertrees.h" #include <bits/stdc++.h> using namespace std; const int maxn = 1010; vector < int > graph[maxn], comp; int cap[maxn][maxn]; int used[maxn]; vector<std::vector<int>> answer; void dfs(int v) { comp.push_back(v); used[v] = 1; for (int u : graph[v]) { if (!used[u]) dfs(u); } } bool solve_component() { for (int i = 0; i < comp.size(); i ++) for (int j = 0; j < comp.size(); j ++) if (cap[comp[i]][comp[j]] == 0) return false; if (comp.size() != 1) { if (cap[comp[0]][comp[1]] == 2) { if (comp.size() == 2) return false; answer[comp[0]][comp.back()] = 1; answer[comp.back()][comp[0]] = 1; } } for (int i = 0; i < (int)(comp.size()) - 1; i ++) { answer[comp[i]][comp[i + 1]] = 1; answer[comp[i + 1]][comp[i]] = 1; } return true; } int construct(std::vector<std::vector<int>> p) { int n = p.size(); for (int i = 0; i < n; i++) { std::vector<int> row; row.resize(n, 0); answer.push_back(row); } for (int i = 0; i < n; i ++) for (int j = 0; j < n; j ++) cap[i][j] = p[i][j]; for (int i = 0; i < n; i ++) for (int j = 0; j < n; j ++) { if (i != j && p[i][j] != 0) graph[i].push_back(j); } for (int i = 0; i < n; i ++) { if (!used[i]) { comp.clear(); dfs(i); bool is_fine = solve_component(); if (!is_fine) return 0; } } build(answer); return 1; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 260 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 9 ms | 2260 KB | Output is correct |
7 | Correct | 198 ms | 30212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 260 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 9 ms | 2260 KB | Output is correct |
7 | Correct | 198 ms | 30212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 11 ms | 2004 KB | Output is correct |
13 | Correct | 181 ms | 26052 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 7 ms | 1748 KB | Output is correct |
17 | Correct | 95 ms | 18644 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 47 ms | 7884 KB | Output is correct |
21 | Correct | 185 ms | 26572 KB | Output is correct |
22 | Correct | 196 ms | 26144 KB | Output is correct |
23 | Correct | 185 ms | 28100 KB | Output is correct |
24 | Correct | 193 ms | 26072 KB | Output is correct |
25 | Correct | 82 ms | 16704 KB | Output is correct |
26 | Correct | 80 ms | 16328 KB | Output is correct |
27 | Correct | 203 ms | 29164 KB | Output is correct |
28 | Correct | 184 ms | 26096 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 1 ms | 340 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 8 ms | 2004 KB | Output is correct |
9 | Correct | 187 ms | 28052 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 9 ms | 2240 KB | Output is correct |
13 | Correct | 185 ms | 31952 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 4 ms | 1748 KB | Output is correct |
17 | Correct | 87 ms | 20500 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 332 KB | Output is correct |
21 | Correct | 67 ms | 8208 KB | Output is correct |
22 | Correct | 185 ms | 28416 KB | Output is correct |
23 | Correct | 191 ms | 28100 KB | Output is correct |
24 | Correct | 187 ms | 31124 KB | Output is correct |
25 | Correct | 78 ms | 18080 KB | Output is correct |
26 | Correct | 88 ms | 18572 KB | Output is correct |
27 | Correct | 179 ms | 27932 KB | Output is correct |
28 | Correct | 221 ms | 29972 KB | Output is correct |
29 | Correct | 79 ms | 18064 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 1 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 65 ms | 7900 KB | Output is correct |
5 | Correct | 186 ms | 26680 KB | Output is correct |
6 | Correct | 225 ms | 26248 KB | Output is correct |
7 | Correct | 211 ms | 28296 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 48 ms | 7892 KB | Output is correct |
10 | Correct | 205 ms | 26776 KB | Output is correct |
11 | Correct | 184 ms | 26188 KB | Output is correct |
12 | Correct | 209 ms | 29516 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Incorrect | 1 ms | 340 KB | Too many ways to get from 0 to 4, should be 1 found no less than 2 |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 260 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 9 ms | 2260 KB | Output is correct |
7 | Correct | 198 ms | 30212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 11 ms | 2004 KB | Output is correct |
13 | Correct | 181 ms | 26052 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 7 ms | 1748 KB | Output is correct |
17 | Correct | 95 ms | 18644 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 47 ms | 7884 KB | Output is correct |
21 | Correct | 185 ms | 26572 KB | Output is correct |
22 | Correct | 196 ms | 26144 KB | Output is correct |
23 | Correct | 185 ms | 28100 KB | Output is correct |
24 | Correct | 193 ms | 26072 KB | Output is correct |
25 | Correct | 82 ms | 16704 KB | Output is correct |
26 | Correct | 80 ms | 16328 KB | Output is correct |
27 | Correct | 203 ms | 29164 KB | Output is correct |
28 | Correct | 184 ms | 26096 KB | Output is correct |
29 | Correct | 1 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 1 ms | 340 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 1 ms | 340 KB | Output is correct |
34 | Correct | 1 ms | 340 KB | Output is correct |
35 | Correct | 1 ms | 340 KB | Output is correct |
36 | Correct | 8 ms | 2004 KB | Output is correct |
37 | Correct | 187 ms | 28052 KB | Output is correct |
38 | Correct | 1 ms | 340 KB | Output is correct |
39 | Correct | 1 ms | 340 KB | Output is correct |
40 | Correct | 9 ms | 2240 KB | Output is correct |
41 | Correct | 185 ms | 31952 KB | Output is correct |
42 | Correct | 1 ms | 340 KB | Output is correct |
43 | Correct | 1 ms | 340 KB | Output is correct |
44 | Correct | 4 ms | 1748 KB | Output is correct |
45 | Correct | 87 ms | 20500 KB | Output is correct |
46 | Correct | 1 ms | 340 KB | Output is correct |
47 | Correct | 1 ms | 340 KB | Output is correct |
48 | Correct | 1 ms | 332 KB | Output is correct |
49 | Correct | 67 ms | 8208 KB | Output is correct |
50 | Correct | 185 ms | 28416 KB | Output is correct |
51 | Correct | 191 ms | 28100 KB | Output is correct |
52 | Correct | 187 ms | 31124 KB | Output is correct |
53 | Correct | 78 ms | 18080 KB | Output is correct |
54 | Correct | 88 ms | 18572 KB | Output is correct |
55 | Correct | 179 ms | 27932 KB | Output is correct |
56 | Correct | 221 ms | 29972 KB | Output is correct |
57 | Correct | 79 ms | 18064 KB | Output is correct |
58 | Correct | 1 ms | 332 KB | Output is correct |
59 | Correct | 1 ms | 340 KB | Output is correct |
60 | Correct | 5 ms | 1876 KB | Output is correct |
61 | Correct | 94 ms | 22164 KB | Output is correct |
62 | Correct | 1 ms | 340 KB | Output is correct |
63 | Correct | 1 ms | 336 KB | Output is correct |
64 | Correct | 1 ms | 340 KB | Output is correct |
65 | Incorrect | 45 ms | 8216 KB | Too many ways to get from 1 to 269, should be 1 found no less than 2 |
66 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 260 KB | Output is correct |
3 | Correct | 0 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 9 ms | 2260 KB | Output is correct |
7 | Correct | 198 ms | 30212 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 332 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 11 ms | 2004 KB | Output is correct |
13 | Correct | 181 ms | 26052 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 7 ms | 1748 KB | Output is correct |
17 | Correct | 95 ms | 18644 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 47 ms | 7884 KB | Output is correct |
21 | Correct | 185 ms | 26572 KB | Output is correct |
22 | Correct | 196 ms | 26144 KB | Output is correct |
23 | Correct | 185 ms | 28100 KB | Output is correct |
24 | Correct | 193 ms | 26072 KB | Output is correct |
25 | Correct | 82 ms | 16704 KB | Output is correct |
26 | Correct | 80 ms | 16328 KB | Output is correct |
27 | Correct | 203 ms | 29164 KB | Output is correct |
28 | Correct | 184 ms | 26096 KB | Output is correct |
29 | Correct | 1 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 1 ms | 340 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 1 ms | 340 KB | Output is correct |
34 | Correct | 1 ms | 340 KB | Output is correct |
35 | Correct | 1 ms | 340 KB | Output is correct |
36 | Correct | 8 ms | 2004 KB | Output is correct |
37 | Correct | 187 ms | 28052 KB | Output is correct |
38 | Correct | 1 ms | 340 KB | Output is correct |
39 | Correct | 1 ms | 340 KB | Output is correct |
40 | Correct | 9 ms | 2240 KB | Output is correct |
41 | Correct | 185 ms | 31952 KB | Output is correct |
42 | Correct | 1 ms | 340 KB | Output is correct |
43 | Correct | 1 ms | 340 KB | Output is correct |
44 | Correct | 4 ms | 1748 KB | Output is correct |
45 | Correct | 87 ms | 20500 KB | Output is correct |
46 | Correct | 1 ms | 340 KB | Output is correct |
47 | Correct | 1 ms | 340 KB | Output is correct |
48 | Correct | 1 ms | 332 KB | Output is correct |
49 | Correct | 67 ms | 8208 KB | Output is correct |
50 | Correct | 185 ms | 28416 KB | Output is correct |
51 | Correct | 191 ms | 28100 KB | Output is correct |
52 | Correct | 187 ms | 31124 KB | Output is correct |
53 | Correct | 78 ms | 18080 KB | Output is correct |
54 | Correct | 88 ms | 18572 KB | Output is correct |
55 | Correct | 179 ms | 27932 KB | Output is correct |
56 | Correct | 221 ms | 29972 KB | Output is correct |
57 | Correct | 79 ms | 18064 KB | Output is correct |
58 | Correct | 0 ms | 340 KB | Output is correct |
59 | Correct | 1 ms | 340 KB | Output is correct |
60 | Correct | 1 ms | 332 KB | Output is correct |
61 | Correct | 65 ms | 7900 KB | Output is correct |
62 | Correct | 186 ms | 26680 KB | Output is correct |
63 | Correct | 225 ms | 26248 KB | Output is correct |
64 | Correct | 211 ms | 28296 KB | Output is correct |
65 | Correct | 1 ms | 340 KB | Output is correct |
66 | Correct | 48 ms | 7892 KB | Output is correct |
67 | Correct | 205 ms | 26776 KB | Output is correct |
68 | Correct | 184 ms | 26188 KB | Output is correct |
69 | Correct | 209 ms | 29516 KB | Output is correct |
70 | Correct | 1 ms | 340 KB | Output is correct |
71 | Correct | 1 ms | 340 KB | Output is correct |
72 | Incorrect | 1 ms | 340 KB | Too many ways to get from 0 to 4, should be 1 found no less than 2 |
73 | Halted | 0 ms | 0 KB | - |