# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1014672 | 2024-07-05T09:12:36 Z | Unforgettablepl | 슈퍼트리 잇기 (IOI20_supertrees) | C++17 | 149 ms | 24400 KB |
#include <bits/stdc++.h> using namespace std; void build(std::vector<std::vector<int>> b); int construct(std::vector<std::vector<int>> p) { int n = p.size(); vector<vector<vector<int>>> components; vector<int> componentstype; for(int i=0;i<n;i++){ int mycomponent = -1; for(int compo=0;compo<components.size();compo++){ int shouldbe = p[i][components[compo][0][0]]; shouldbe = min(shouldbe,1); if(shouldbe==1){ if(mycomponent==-1)mycomponent=compo; else return 0; } for(auto&j:components[compo]){ for(int&k:j){ if(shouldbe==0 and p[i][k]!=0)return 0; if(shouldbe==1 and p[i][k]==0)return 0; } } } if(mycomponent==-1){ components.push_back({{i}}); componentstype.push_back(-1); continue; } int mychain = -1; for(int cha=0;cha<components[mycomponent].size();cha++){ int shouldbe = p[i][components[mycomponent][cha][0]]; if(shouldbe==1){ if(mychain==-1)mychain=cha; else return 0; } else { if(componentstype[mycomponent]==-1)componentstype[mycomponent]=shouldbe; else if(componentstype[mycomponent]!=shouldbe)return 0; } for(int&j:components[mycomponent][cha]){ if(shouldbe!=p[i][j])return 0; } } if(mychain==-1)components[mycomponent].push_back({i}); else components[mycomponent][mychain].push_back(i); } vector<vector<int>> ans(n,vector<int>(n)); for(int i=0;i<components.size();i++){ vector<int> heads; for(auto&j:components[i]){ heads.emplace_back(j[0]); for(int k=1;k<j.size();k++){ ans[j[k-1]][j[k]]=ans[j[k]][j[k-1]]=true; } } if(heads.size()==2)return 0; if(heads.size()==1)continue; if(componentstype[i]==3 and heads.size()==3)return 0; heads.emplace_back(heads.front()); for(int j=1;j<heads.size();j++){ ans[heads[j-1]][heads[j]]=ans[heads[j]][heads[j-1]]=true; } if(componentstype[i]==3)ans[heads[0]][heads[2]]=ans[heads[2]][heads[0]]=true; } build(ans); return 1; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 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 | 5 ms | 1372 KB | Output is correct |
7 | Correct | 117 ms | 24052 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 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 | 5 ms | 1372 KB | Output is correct |
7 | Correct | 117 ms | 24052 KB | Output is correct |
8 | Correct | 1 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 | 104 ms | 24064 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 | 604 KB | Output is correct |
17 | Correct | 52 ms | 10116 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 26 ms | 6232 KB | Output is correct |
21 | Correct | 130 ms | 23892 KB | Output is correct |
22 | Correct | 114 ms | 24144 KB | Output is correct |
23 | Correct | 128 ms | 24040 KB | Output is correct |
24 | Correct | 112 ms | 24124 KB | Output is correct |
25 | Correct | 51 ms | 10064 KB | Output is correct |
26 | Correct | 48 ms | 10120 KB | Output is correct |
27 | Correct | 129 ms | 23928 KB | Output is correct |
28 | Correct | 115 ms | 24024 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 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 | 432 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 604 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 5 ms | 1424 KB | Output is correct |
9 | Correct | 115 ms | 24200 KB | Output is correct |
10 | Correct | 1 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 | 123 ms | 24012 KB | Output is correct |
14 | Correct | 1 ms | 348 KB | Output is correct |
15 | Correct | 1 ms | 348 KB | Output is correct |
16 | Correct | 4 ms | 604 KB | Output is correct |
17 | Correct | 63 ms | 10116 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 35 ms | 6284 KB | Output is correct |
22 | Correct | 108 ms | 23992 KB | Output is correct |
23 | Correct | 118 ms | 24400 KB | Output is correct |
24 | Correct | 111 ms | 24148 KB | Output is correct |
25 | Correct | 50 ms | 14164 KB | Output is correct |
26 | Correct | 51 ms | 10064 KB | Output is correct |
27 | Correct | 111 ms | 24200 KB | Output is correct |
28 | Correct | 118 ms | 24068 KB | Output is correct |
29 | Correct | 49 ms | 14160 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 25 ms | 6400 KB | Output is correct |
5 | Correct | 149 ms | 24148 KB | Output is correct |
6 | Correct | 108 ms | 23980 KB | Output is correct |
7 | Correct | 114 ms | 24056 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 27 ms | 6404 KB | Output is correct |
10 | Correct | 108 ms | 24196 KB | Output is correct |
11 | Correct | 108 ms | 24068 KB | Output is correct |
12 | Correct | 107 ms | 24064 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 40 ms | 6236 KB | Output is correct |
17 | Correct | 117 ms | 24144 KB | Output is correct |
18 | Correct | 111 ms | 23940 KB | Output is correct |
19 | Correct | 123 ms | 24184 KB | Output is correct |
20 | Correct | 114 ms | 24148 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 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 | 5 ms | 1372 KB | Output is correct |
7 | Correct | 117 ms | 24052 KB | Output is correct |
8 | Correct | 1 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 | 104 ms | 24064 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 | 604 KB | Output is correct |
17 | Correct | 52 ms | 10116 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 26 ms | 6232 KB | Output is correct |
21 | Correct | 130 ms | 23892 KB | Output is correct |
22 | Correct | 114 ms | 24144 KB | Output is correct |
23 | Correct | 128 ms | 24040 KB | Output is correct |
24 | Correct | 112 ms | 24124 KB | Output is correct |
25 | Correct | 51 ms | 10064 KB | Output is correct |
26 | Correct | 48 ms | 10120 KB | Output is correct |
27 | Correct | 129 ms | 23928 KB | Output is correct |
28 | Correct | 115 ms | 24024 KB | Output is correct |
29 | Correct | 0 ms | 348 KB | Output is correct |
30 | Correct | 0 ms | 348 KB | Output is correct |
31 | Correct | 0 ms | 348 KB | Output is correct |
32 | Correct | 0 ms | 432 KB | Output is correct |
33 | Correct | 0 ms | 348 KB | Output is correct |
34 | Correct | 1 ms | 604 KB | Output is correct |
35 | Correct | 0 ms | 348 KB | Output is correct |
36 | Correct | 5 ms | 1424 KB | Output is correct |
37 | Correct | 115 ms | 24200 KB | Output is correct |
38 | Correct | 1 ms | 348 KB | Output is correct |
39 | Correct | 0 ms | 348 KB | Output is correct |
40 | Correct | 5 ms | 1372 KB | Output is correct |
41 | Correct | 123 ms | 24012 KB | Output is correct |
42 | Correct | 1 ms | 348 KB | Output is correct |
43 | Correct | 1 ms | 348 KB | Output is correct |
44 | Correct | 4 ms | 604 KB | Output is correct |
45 | Correct | 63 ms | 10116 KB | Output is correct |
46 | Correct | 0 ms | 348 KB | Output is correct |
47 | Correct | 0 ms | 348 KB | Output is correct |
48 | Correct | 0 ms | 348 KB | Output is correct |
49 | Correct | 35 ms | 6284 KB | Output is correct |
50 | Correct | 108 ms | 23992 KB | Output is correct |
51 | Correct | 118 ms | 24400 KB | Output is correct |
52 | Correct | 111 ms | 24148 KB | Output is correct |
53 | Correct | 50 ms | 14164 KB | Output is correct |
54 | Correct | 51 ms | 10064 KB | Output is correct |
55 | Correct | 111 ms | 24200 KB | Output is correct |
56 | Correct | 118 ms | 24068 KB | Output is correct |
57 | Correct | 49 ms | 14160 KB | Output is correct |
58 | Correct | 0 ms | 348 KB | Output is correct |
59 | Correct | 0 ms | 436 KB | Output is correct |
60 | Correct | 2 ms | 604 KB | Output is correct |
61 | Correct | 57 ms | 10068 KB | Output is correct |
62 | Correct | 0 ms | 348 KB | Output is correct |
63 | Correct | 0 ms | 348 KB | Output is correct |
64 | Correct | 0 ms | 348 KB | Output is correct |
65 | Correct | 32 ms | 6324 KB | Output is correct |
66 | Correct | 49 ms | 10064 KB | Output is correct |
67 | Correct | 49 ms | 10068 KB | Output is correct |
68 | Correct | 48 ms | 10120 KB | Output is correct |
69 | Correct | 50 ms | 14160 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 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 | 5 ms | 1372 KB | Output is correct |
7 | Correct | 117 ms | 24052 KB | Output is correct |
8 | Correct | 1 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 | 104 ms | 24064 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 | 604 KB | Output is correct |
17 | Correct | 52 ms | 10116 KB | Output is correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 26 ms | 6232 KB | Output is correct |
21 | Correct | 130 ms | 23892 KB | Output is correct |
22 | Correct | 114 ms | 24144 KB | Output is correct |
23 | Correct | 128 ms | 24040 KB | Output is correct |
24 | Correct | 112 ms | 24124 KB | Output is correct |
25 | Correct | 51 ms | 10064 KB | Output is correct |
26 | Correct | 48 ms | 10120 KB | Output is correct |
27 | Correct | 129 ms | 23928 KB | Output is correct |
28 | Correct | 115 ms | 24024 KB | Output is correct |
29 | Correct | 0 ms | 348 KB | Output is correct |
30 | Correct | 0 ms | 348 KB | Output is correct |
31 | Correct | 0 ms | 348 KB | Output is correct |
32 | Correct | 0 ms | 432 KB | Output is correct |
33 | Correct | 0 ms | 348 KB | Output is correct |
34 | Correct | 1 ms | 604 KB | Output is correct |
35 | Correct | 0 ms | 348 KB | Output is correct |
36 | Correct | 5 ms | 1424 KB | Output is correct |
37 | Correct | 115 ms | 24200 KB | Output is correct |
38 | Correct | 1 ms | 348 KB | Output is correct |
39 | Correct | 0 ms | 348 KB | Output is correct |
40 | Correct | 5 ms | 1372 KB | Output is correct |
41 | Correct | 123 ms | 24012 KB | Output is correct |
42 | Correct | 1 ms | 348 KB | Output is correct |
43 | Correct | 1 ms | 348 KB | Output is correct |
44 | Correct | 4 ms | 604 KB | Output is correct |
45 | Correct | 63 ms | 10116 KB | Output is correct |
46 | Correct | 0 ms | 348 KB | Output is correct |
47 | Correct | 0 ms | 348 KB | Output is correct |
48 | Correct | 0 ms | 348 KB | Output is correct |
49 | Correct | 35 ms | 6284 KB | Output is correct |
50 | Correct | 108 ms | 23992 KB | Output is correct |
51 | Correct | 118 ms | 24400 KB | Output is correct |
52 | Correct | 111 ms | 24148 KB | Output is correct |
53 | Correct | 50 ms | 14164 KB | Output is correct |
54 | Correct | 51 ms | 10064 KB | Output is correct |
55 | Correct | 111 ms | 24200 KB | Output is correct |
56 | Correct | 118 ms | 24068 KB | Output is correct |
57 | Correct | 49 ms | 14160 KB | Output is correct |
58 | Correct | 1 ms | 344 KB | Output is correct |
59 | Correct | 0 ms | 344 KB | Output is correct |
60 | Correct | 0 ms | 348 KB | Output is correct |
61 | Correct | 25 ms | 6400 KB | Output is correct |
62 | Correct | 149 ms | 24148 KB | Output is correct |
63 | Correct | 108 ms | 23980 KB | Output is correct |
64 | Correct | 114 ms | 24056 KB | Output is correct |
65 | Correct | 0 ms | 348 KB | Output is correct |
66 | Correct | 27 ms | 6404 KB | Output is correct |
67 | Correct | 108 ms | 24196 KB | Output is correct |
68 | Correct | 108 ms | 24068 KB | Output is correct |
69 | Correct | 107 ms | 24064 KB | Output is correct |
70 | Correct | 0 ms | 348 KB | Output is correct |
71 | Correct | 0 ms | 348 KB | Output is correct |
72 | Correct | 0 ms | 348 KB | Output is correct |
73 | Correct | 40 ms | 6236 KB | Output is correct |
74 | Correct | 117 ms | 24144 KB | Output is correct |
75 | Correct | 111 ms | 23940 KB | Output is correct |
76 | Correct | 123 ms | 24184 KB | Output is correct |
77 | Correct | 114 ms | 24148 KB | Output is correct |
78 | Correct | 0 ms | 348 KB | Output is correct |
79 | Correct | 0 ms | 436 KB | Output is correct |
80 | Correct | 2 ms | 604 KB | Output is correct |
81 | Correct | 57 ms | 10068 KB | Output is correct |
82 | Correct | 0 ms | 348 KB | Output is correct |
83 | Correct | 0 ms | 348 KB | Output is correct |
84 | Correct | 0 ms | 348 KB | Output is correct |
85 | Correct | 32 ms | 6324 KB | Output is correct |
86 | Correct | 49 ms | 10064 KB | Output is correct |
87 | Correct | 49 ms | 10068 KB | Output is correct |
88 | Correct | 48 ms | 10120 KB | Output is correct |
89 | Correct | 50 ms | 14160 KB | Output is correct |
90 | Correct | 0 ms | 348 KB | Output is correct |
91 | Correct | 0 ms | 348 KB | Output is correct |
92 | Correct | 2 ms | 676 KB | Output is correct |
93 | Correct | 67 ms | 10064 KB | Output is correct |
94 | Correct | 1 ms | 348 KB | Output is correct |
95 | Correct | 0 ms | 348 KB | Output is correct |
96 | Correct | 0 ms | 348 KB | Output is correct |
97 | Correct | 13 ms | 2908 KB | Output is correct |
98 | Correct | 50 ms | 10156 KB | Output is correct |
99 | Correct | 48 ms | 10064 KB | Output is correct |
100 | Correct | 52 ms | 10104 KB | Output is correct |
101 | Correct | 49 ms | 14160 KB | Output is correct |
102 | Incorrect | 128 ms | 24068 KB | Answer gives possible 1 while actual possible 0 |
103 | Halted | 0 ms | 0 KB | - |