# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
721935 | 2023-04-11T08:58:12 Z | danikoynov | 슈퍼트리 잇기 (IOI20_supertrees) | C++14 | 263 ms | 30996 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; for (int i = 0; i < (int)(comp.size()) - 1; i ++) { answer[comp[i]][comp[i + 1]] = 1; answer[comp[i + 1]][comp[i]] = 1; } if (comp.size() != 1) { if (cap[comp[0]][comp[1]] == 2) { answer[comp[0]][comp.back()] = 1; answer[comp.back()][comp[0]] = 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 | 0 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 | 9 ms | 2132 KB | Output is correct |
7 | Correct | 194 ms | 30112 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 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 | 9 ms | 2132 KB | Output is correct |
7 | Correct | 194 ms | 30112 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 12 ms | 1936 KB | Output is correct |
13 | Correct | 186 ms | 26020 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 5 ms | 1620 KB | Output is correct |
17 | Correct | 100 ms | 18600 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 55 ms | 7720 KB | Output is correct |
21 | Correct | 193 ms | 26536 KB | Output is correct |
22 | Correct | 186 ms | 25992 KB | Output is correct |
23 | Correct | 206 ms | 28080 KB | Output is correct |
24 | Correct | 204 ms | 26036 KB | Output is correct |
25 | Correct | 80 ms | 16552 KB | Output is correct |
26 | Correct | 91 ms | 16040 KB | Output is correct |
27 | Correct | 231 ms | 29044 KB | Output is correct |
28 | Correct | 179 ms | 25932 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 | 212 KB | Output is correct |
4 | Incorrect | 1 ms | 340 KB | Answer gives possible 1 while actual possible 0 |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | 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 | 58 ms | 8228 KB | Output is correct |
5 | Correct | 211 ms | 28452 KB | Output is correct |
6 | Correct | 248 ms | 27936 KB | Output is correct |
7 | Correct | 263 ms | 30004 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 66 ms | 8208 KB | Output is correct |
10 | Correct | 180 ms | 28428 KB | Output is correct |
11 | Correct | 189 ms | 27920 KB | Output is correct |
12 | Correct | 207 ms | 30996 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 | 332 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 | 0 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 | 9 ms | 2132 KB | Output is correct |
7 | Correct | 194 ms | 30112 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 12 ms | 1936 KB | Output is correct |
13 | Correct | 186 ms | 26020 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 5 ms | 1620 KB | Output is correct |
17 | Correct | 100 ms | 18600 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 55 ms | 7720 KB | Output is correct |
21 | Correct | 193 ms | 26536 KB | Output is correct |
22 | Correct | 186 ms | 25992 KB | Output is correct |
23 | Correct | 206 ms | 28080 KB | Output is correct |
24 | Correct | 204 ms | 26036 KB | Output is correct |
25 | Correct | 80 ms | 16552 KB | Output is correct |
26 | Correct | 91 ms | 16040 KB | Output is correct |
27 | Correct | 231 ms | 29044 KB | Output is correct |
28 | Correct | 179 ms | 25932 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 | 212 KB | Output is correct |
32 | Incorrect | 1 ms | 340 KB | Answer gives possible 1 while actual possible 0 |
33 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 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 | 9 ms | 2132 KB | Output is correct |
7 | Correct | 194 ms | 30112 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 12 ms | 1936 KB | Output is correct |
13 | Correct | 186 ms | 26020 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 5 ms | 1620 KB | Output is correct |
17 | Correct | 100 ms | 18600 KB | Output is correct |
18 | Correct | 0 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 55 ms | 7720 KB | Output is correct |
21 | Correct | 193 ms | 26536 KB | Output is correct |
22 | Correct | 186 ms | 25992 KB | Output is correct |
23 | Correct | 206 ms | 28080 KB | Output is correct |
24 | Correct | 204 ms | 26036 KB | Output is correct |
25 | Correct | 80 ms | 16552 KB | Output is correct |
26 | Correct | 91 ms | 16040 KB | Output is correct |
27 | Correct | 231 ms | 29044 KB | Output is correct |
28 | Correct | 179 ms | 25932 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 | 212 KB | Output is correct |
32 | Incorrect | 1 ms | 340 KB | Answer gives possible 1 while actual possible 0 |
33 | Halted | 0 ms | 0 KB | - |