# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1087035 | 2024-09-12T05:53:42 Z | SulA | 슈퍼트리 잇기 (IOI20_supertrees) | C++17 | 128 ms | 32292 KB |
#include "supertrees.h" #include <iostream> #include <vector> using namespace std; vector<int> adj[1000], comp; bool visited[1000]; void dfs(int u) { comp.push_back(u); visited[u] = -true; for (int v: adj[u]) if (!visited[v]) { dfs(v); } } int construct(vector<vector<int>> p) { int n = p.size(), mx = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { mx = max(mx, p[i][j]); if (p[i][j] != 0) { adj[i].push_back(j); adj[j].push_back(i); } } } vector<vector<int>> adj(n, vector<int>(n, 0)); for (int i = 0; i < n; i++) if (!visited[i]) { comp.clear(); dfs(i); for (int j = 0; j < comp.size() - 1; j++) { adj[ comp[j] ][ comp[j+1] ] = adj[ comp[j+1] ][ comp[j] ] = 1; } if (mx == 2) { if (comp.size() < 3) return 0; adj[comp.front()][comp.back()] = adj[comp.back()][comp.front()] = 1; } } build(adj); return 1; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | 0 ms | 348 KB | Output is correct |
6 | Correct | 6 ms | 1628 KB | Output is correct |
7 | Correct | 122 ms | 32292 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | 0 ms | 348 KB | Output is correct |
6 | Correct | 6 ms | 1628 KB | Output is correct |
7 | Correct | 122 ms | 32292 KB | Output is correct |
8 | Correct | 1 ms | 600 KB | Output is correct |
9 | Correct | 0 ms | 460 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 | 1372 KB | Output is correct |
13 | Correct | 113 ms | 24148 KB | Output is correct |
14 | Incorrect | 1 ms | 348 KB | Answer gives possible 1 while actual possible 0 |
15 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 460 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 408 KB | Output is correct |
8 | Correct | 9 ms | 1240 KB | Output is correct |
9 | Correct | 114 ms | 24188 KB | Output is correct |
10 | Correct | 0 ms | 344 KB | Output is correct |
11 | Correct | 1 ms | 344 KB | Output is correct |
12 | Correct | 10 ms | 1624 KB | Output is correct |
13 | Correct | 128 ms | 32080 KB | Output is correct |
14 | Incorrect | 0 ms | 348 KB | Answer gives possible 1 while actual possible 0 |
15 | 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 | 348 KB | Output is correct |
4 | Correct | 29 ms | 6424 KB | Output is correct |
5 | Correct | 121 ms | 25172 KB | Output is correct |
6 | Correct | 117 ms | 24148 KB | Output is correct |
7 | Correct | 125 ms | 28176 KB | Output is correct |
8 | Incorrect | 1 ms | 348 KB | Answer gives possible 0 while actual possible 1 |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | 0 ms | 348 KB | Output is correct |
6 | Correct | 6 ms | 1628 KB | Output is correct |
7 | Correct | 122 ms | 32292 KB | Output is correct |
8 | Correct | 1 ms | 600 KB | Output is correct |
9 | Correct | 0 ms | 460 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 | 1372 KB | Output is correct |
13 | Correct | 113 ms | 24148 KB | Output is correct |
14 | Incorrect | 1 ms | 348 KB | Answer gives possible 1 while actual possible 0 |
15 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | 0 ms | 348 KB | Output is correct |
6 | Correct | 6 ms | 1628 KB | Output is correct |
7 | Correct | 122 ms | 32292 KB | Output is correct |
8 | Correct | 1 ms | 600 KB | Output is correct |
9 | Correct | 0 ms | 460 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 | 1372 KB | Output is correct |
13 | Correct | 113 ms | 24148 KB | Output is correct |
14 | Incorrect | 1 ms | 348 KB | Answer gives possible 1 while actual possible 0 |
15 | Halted | 0 ms | 0 KB | - |