# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1000327 | 2024-06-17T08:52:09 Z | codefox | 슈퍼트리 잇기 (IOI20_supertrees) | C++14 | 129 ms | 22104 KB |
#include<bits/stdc++.h> #include "supertrees.h" using namespace std; int construct(std::vector<std::vector<int>> p) { int n = p.size(); vector<int> rep(n); iota(rep.begin(), rep.end(), 0); vector<vector<int>> b(n, vector<int>(n)); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (p[i][j]==3) return 0; } } for (int i = 0; i < n; i++) { if (rep[i]!=i) continue; for (int j = i+1; j < n; j++) { if (p[i][j]!=1) continue; for (int k = 0; k < n; k++) { if (p[i][k]!=p[j][k]) return 0; } b[i][j] = 1; b[j][i] = 1; rep[j] = i; } } vector<int> vis(n,0); for (int i = 0; i < n; i++) { if (rep[i]!=i) continue; if (vis[i]) continue; vector<int> cyc; for (int j = i+1; j < n; j++) { if (p[i][j]!=2) continue; if (rep[j]!=j) continue; for (int k = 0; k < n; k++) { if (p[i][k]==1 && rep[k]==i && p[j][k]==2) continue; if (p[i][k]==2 && p[j][k]==1 && rep[k]==j) continue; if (p[i][k]==2 && p[j][k]==2) continue; if (p[i][k]==0 && p[j][k]==0) continue; return 0; } vis[j] = 1; } if (cyc.empty()) continue; if (cyc.size()==1) return 0; for (int j = 0; j < cyc.size()-1; j++) { b[cyc[j]][cyc[j+1]] = 1; b[cyc[j+1]][cyc[j]] = 1; } b[i][cyc.back()] = 1; b[cyc.back()][i] = 1; b[i][cyc[0]] = 1; b[cyc[0]][i] = 1; } build(b); return 1; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 5 ms | 1116 KB | Output is correct |
7 | Correct | 110 ms | 21964 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 5 ms | 1116 KB | Output is correct |
7 | Correct | 110 ms | 21964 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 | 1116 KB | Output is correct |
13 | Correct | 120 ms | 22104 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 2 ms | 860 KB | Output is correct |
17 | Correct | 56 ms | 12040 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 28 ms | 5844 KB | Output is correct |
21 | Correct | 129 ms | 22100 KB | Output is correct |
22 | Correct | 102 ms | 22100 KB | Output is correct |
23 | Correct | 120 ms | 22024 KB | Output is correct |
24 | Correct | 110 ms | 22100 KB | Output is correct |
25 | Correct | 48 ms | 12040 KB | Output is correct |
26 | Correct | 66 ms | 12116 KB | Output is correct |
27 | Correct | 128 ms | 22024 KB | Output is correct |
28 | Correct | 104 ms | 22104 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 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 | 348 KB | Too few ways to get from 0 to 1, should be 2 found 0 |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 5 ms | 1116 KB | Output is correct |
7 | Correct | 110 ms | 21964 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 | 1116 KB | Output is correct |
13 | Correct | 120 ms | 22104 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 2 ms | 860 KB | Output is correct |
17 | Correct | 56 ms | 12040 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 28 ms | 5844 KB | Output is correct |
21 | Correct | 129 ms | 22100 KB | Output is correct |
22 | Correct | 102 ms | 22100 KB | Output is correct |
23 | Correct | 120 ms | 22024 KB | Output is correct |
24 | Correct | 110 ms | 22100 KB | Output is correct |
25 | Correct | 48 ms | 12040 KB | Output is correct |
26 | Correct | 66 ms | 12116 KB | Output is correct |
27 | Correct | 128 ms | 22024 KB | Output is correct |
28 | Correct | 104 ms | 22104 KB | Output is correct |
29 | Correct | 0 ms | 344 KB | Output is correct |
30 | Correct | 1 ms | 348 KB | Output is correct |
31 | Correct | 0 ms | 348 KB | Output is correct |
32 | Incorrect | 0 ms | 348 KB | Answer gives possible 1 while actual possible 0 |
33 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 5 ms | 1116 KB | Output is correct |
7 | Correct | 110 ms | 21964 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 | 1116 KB | Output is correct |
13 | Correct | 120 ms | 22104 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 2 ms | 860 KB | Output is correct |
17 | Correct | 56 ms | 12040 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 28 ms | 5844 KB | Output is correct |
21 | Correct | 129 ms | 22100 KB | Output is correct |
22 | Correct | 102 ms | 22100 KB | Output is correct |
23 | Correct | 120 ms | 22024 KB | Output is correct |
24 | Correct | 110 ms | 22100 KB | Output is correct |
25 | Correct | 48 ms | 12040 KB | Output is correct |
26 | Correct | 66 ms | 12116 KB | Output is correct |
27 | Correct | 128 ms | 22024 KB | Output is correct |
28 | Correct | 104 ms | 22104 KB | Output is correct |
29 | Correct | 0 ms | 344 KB | Output is correct |
30 | Correct | 1 ms | 348 KB | Output is correct |
31 | Correct | 0 ms | 348 KB | Output is correct |
32 | Incorrect | 0 ms | 348 KB | Answer gives possible 1 while actual possible 0 |
33 | Halted | 0 ms | 0 KB | - |