# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1048493 | 2024-08-08T07:55:57 Z | 김은성(#11035) | Make them Meet (EGOI24_makethemmeet) | C++17 | 130 ms | 14964 KB |
#include <bits/stdc++.h> using namespace std; vector<int> graph[109]; vector<vector<int> > moves; vector<vector<int> > st; int n, color[109]; void reset(){ for(int i=0; i<n; i++) color[i] = i+1; } void make_move(){ vector<int> temp; for(int i=0; i<n; i++) temp.push_back(color[i]); moves.push_back(temp); st.push_back(temp); } void go_back(){ while(!st.empty()){ moves.push_back(st.back()); st.pop_back(); } } void go_back_one(){ assert(!st.empty()); moves.push_back(st.back()); st.pop_back(); } void answer(){ assert(moves.size() <= 20000); printf("%d\n", moves.size()); for(vector<int> u: moves){ for(int v: u) printf("%d ", v); printf("\n"); } } vector<int> tree[109], child[109]; bool ch[109]; int par[109]; void dfs_span(int v){ ch[v] = 1; for(int u: graph[v]){ if(!ch[u]){ tree[v].push_back(u); tree[u].push_back(v); child[v].push_back(u); dfs_span(u); par[u] = v; } } } void dfs(int v){ ch[v] = 1; for(int u: tree[v]){ if(!ch[u]){ reset(); color[v] = color[u] = v+1; make_move(); dfs(u); go_back_one(); } } } int main(){ int m, i, j, k, u, v; scanf("%d %d", &n, &m); for(i=1; i<=m; i++){ scanf("%d %d", &u, &v); graph[u].push_back(v); graph[v].push_back(u); } dfs_span(0); for(i=0; i<n; i++){ memset(ch, 0, sizeof(ch)); dfs(i); } answer(); return 0; } /* for(i=1; i<n; i++){ for(k=0; k<n; k++){ color[k]= k+1; } bool ch[109] = {0, }; vector<int> vec; for(j=0; j<n; j++){ if(!ch[j]){ for(int j2 = j; !ch[j2]; j2 = (j2 + i) % n){ //printf("j2=%d\n", j2); vec.push_back(j2); ch[j2]= 1; } } } for(k=0; k<n; k++){ color[k]= k+1; } for(j=0; j<vec.size()-1; j+=2){ color[vec[j]] = color[(vec[j] + i) % n] = vec[j]+1; } make_move(); make_move(); for(k=0; k<n; k++){ color[k]= k+1; } for(j=1; j<vec.size()-1; j+=2){ color[vec[j]] = color[(vec[j] + i) % n] = vec[j]+1; } make_move(); make_move(); for(k=0; k<n; k++){ color[k]= k+1; } for(j=vec.size()-1; j<=vec.size()-1; j+=2){ color[vec[j]] = color[(vec[j] + i) % n] = vec[j]+1; } make_move(); make_move(); } answer(); return 0; */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | Partially correct | 92 ms | 14344 KB | Partially correct |
5 | Partially correct | 88 ms | 14656 KB | Partially 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 | Partially correct | 3 ms | 860 KB | Partially correct |
7 | Partially correct | 6 ms | 1372 KB | Partially correct |
8 | Partially correct | 11 ms | 2140 KB | Partially correct |
9 | Partially correct | 91 ms | 14728 KB | Partially 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 | Partially correct | 10 ms | 2008 KB | Partially correct |
5 | Partially correct | 86 ms | 14216 KB | Partially correct |
6 | Partially correct | 96 ms | 14660 KB | Partially correct |
7 | Partially correct | 22 ms | 4104 KB | Partially correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | Partially correct | 92 ms | 14344 KB | Partially correct |
5 | Partially correct | 88 ms | 14656 KB | Partially correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Partially correct | 10 ms | 2008 KB | Partially correct |
10 | Partially correct | 86 ms | 14216 KB | Partially correct |
11 | Partially correct | 96 ms | 14660 KB | Partially correct |
12 | Partially correct | 22 ms | 4104 KB | Partially 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 | Partially correct | 130 ms | 14196 KB | Partially correct |
17 | Partially correct | 102 ms | 14584 KB | Partially correct |
18 | Correct | 0 ms | 344 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Partially correct | 10 ms | 2140 KB | Partially correct |
21 | Partially correct | 82 ms | 14340 KB | Partially correct |
22 | Partially correct | 87 ms | 14600 KB | Partially correct |
23 | Partially correct | 22 ms | 4184 KB | Partially correct |
24 | Correct | 0 ms | 344 KB | Output is correct |
25 | Correct | 0 ms | 348 KB | Output is correct |
26 | Correct | 0 ms | 348 KB | Output is correct |
27 | Partially correct | 83 ms | 14696 KB | Partially correct |
28 | Partially correct | 83 ms | 14604 KB | Partially correct |
29 | Partially correct | 87 ms | 14764 KB | Partially correct |
30 | Partially correct | 81 ms | 14692 KB | Partially correct |
31 | Partially correct | 82 ms | 14620 KB | Partially correct |
32 | Partially correct | 86 ms | 14624 KB | Partially correct |
33 | Partially correct | 83 ms | 14668 KB | Partially correct |
34 | Partially correct | 97 ms | 14720 KB | Partially correct |
35 | Partially correct | 82 ms | 14600 KB | Partially correct |
36 | Partially correct | 83 ms | 14780 KB | Partially correct |
37 | Partially correct | 85 ms | 14604 KB | Partially correct |
38 | Partially correct | 104 ms | 14628 KB | Partially correct |
39 | Partially correct | 86 ms | 14600 KB | Partially correct |
40 | Partially correct | 84 ms | 14596 KB | Partially correct |
41 | Partially correct | 85 ms | 14600 KB | Partially correct |
42 | Partially correct | 82 ms | 14680 KB | Partially correct |
43 | Partially correct | 91 ms | 14596 KB | Partially correct |
44 | Partially correct | 85 ms | 14596 KB | Partially correct |
45 | Partially correct | 83 ms | 14600 KB | Partially correct |
46 | Correct | 0 ms | 344 KB | Output is correct |
47 | Correct | 0 ms | 348 KB | Output is correct |
48 | Correct | 0 ms | 348 KB | Output is correct |
49 | Correct | 0 ms | 348 KB | Output is correct |
50 | Correct | 0 ms | 348 KB | Output is correct |
51 | Correct | 0 ms | 348 KB | Output is correct |
52 | Correct | 0 ms | 348 KB | Output is correct |
53 | Correct | 0 ms | 348 KB | Output is correct |
54 | Correct | 0 ms | 348 KB | Output is correct |
55 | Correct | 0 ms | 348 KB | Output is correct |
56 | Correct | 0 ms | 348 KB | Output is correct |
57 | Correct | 0 ms | 348 KB | Output is correct |
58 | Correct | 0 ms | 348 KB | Output is correct |
59 | Correct | 0 ms | 348 KB | Output is correct |
60 | Correct | 0 ms | 348 KB | Output is correct |
61 | Correct | 0 ms | 348 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 | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | Partially correct | 92 ms | 14344 KB | Partially correct |
5 | Partially correct | 88 ms | 14656 KB | Partially correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 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 | Partially correct | 3 ms | 860 KB | Partially correct |
12 | Partially correct | 6 ms | 1372 KB | Partially correct |
13 | Partially correct | 11 ms | 2140 KB | Partially correct |
14 | Partially correct | 91 ms | 14728 KB | Partially correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Partially correct | 10 ms | 2008 KB | Partially correct |
19 | Partially correct | 86 ms | 14216 KB | Partially correct |
20 | Partially correct | 96 ms | 14660 KB | Partially correct |
21 | Partially correct | 22 ms | 4104 KB | Partially correct |
22 | Correct | 0 ms | 348 KB | Output is correct |
23 | Correct | 0 ms | 348 KB | Output is correct |
24 | Correct | 0 ms | 348 KB | Output is correct |
25 | Partially correct | 130 ms | 14196 KB | Partially correct |
26 | Partially correct | 102 ms | 14584 KB | Partially correct |
27 | Correct | 0 ms | 344 KB | Output is correct |
28 | Correct | 0 ms | 348 KB | Output is correct |
29 | Partially correct | 10 ms | 2140 KB | Partially correct |
30 | Partially correct | 82 ms | 14340 KB | Partially correct |
31 | Partially correct | 87 ms | 14600 KB | Partially correct |
32 | Partially correct | 22 ms | 4184 KB | Partially correct |
33 | Correct | 0 ms | 344 KB | Output is correct |
34 | Correct | 0 ms | 348 KB | Output is correct |
35 | Correct | 0 ms | 348 KB | Output is correct |
36 | Partially correct | 83 ms | 14696 KB | Partially correct |
37 | Partially correct | 83 ms | 14604 KB | Partially correct |
38 | Partially correct | 87 ms | 14764 KB | Partially correct |
39 | Partially correct | 81 ms | 14692 KB | Partially correct |
40 | Partially correct | 82 ms | 14620 KB | Partially correct |
41 | Partially correct | 86 ms | 14624 KB | Partially correct |
42 | Partially correct | 83 ms | 14668 KB | Partially correct |
43 | Partially correct | 97 ms | 14720 KB | Partially correct |
44 | Partially correct | 82 ms | 14600 KB | Partially correct |
45 | Partially correct | 83 ms | 14780 KB | Partially correct |
46 | Partially correct | 85 ms | 14604 KB | Partially correct |
47 | Partially correct | 104 ms | 14628 KB | Partially correct |
48 | Partially correct | 86 ms | 14600 KB | Partially correct |
49 | Partially correct | 84 ms | 14596 KB | Partially correct |
50 | Partially correct | 85 ms | 14600 KB | Partially correct |
51 | Partially correct | 82 ms | 14680 KB | Partially correct |
52 | Partially correct | 91 ms | 14596 KB | Partially correct |
53 | Partially correct | 85 ms | 14596 KB | Partially correct |
54 | Partially correct | 83 ms | 14600 KB | Partially correct |
55 | Correct | 0 ms | 344 KB | Output is correct |
56 | Correct | 0 ms | 348 KB | Output is correct |
57 | Correct | 0 ms | 348 KB | Output is correct |
58 | Correct | 0 ms | 348 KB | Output is correct |
59 | Correct | 0 ms | 348 KB | Output is correct |
60 | Correct | 0 ms | 348 KB | Output is correct |
61 | Correct | 0 ms | 348 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 | 0 ms | 348 KB | Output is correct |
66 | Correct | 0 ms | 348 KB | Output is correct |
67 | Correct | 0 ms | 348 KB | Output is correct |
68 | Correct | 0 ms | 348 KB | Output is correct |
69 | Correct | 0 ms | 348 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 | 0 ms | 348 KB | Output is correct |
74 | Correct | 0 ms | 348 KB | Output is correct |
75 | Correct | 0 ms | 348 KB | Output is correct |
76 | Correct | 0 ms | 348 KB | Output is correct |
77 | Correct | 0 ms | 348 KB | Output is correct |
78 | Partially correct | 91 ms | 14276 KB | Partially correct |
79 | Partially correct | 84 ms | 14748 KB | Partially correct |
80 | Correct | 0 ms | 348 KB | Output is correct |
81 | Correct | 0 ms | 348 KB | Output is correct |
82 | Correct | 0 ms | 348 KB | Output is correct |
83 | Correct | 1 ms | 348 KB | Output is correct |
84 | Partially correct | 3 ms | 820 KB | Partially correct |
85 | Partially correct | 6 ms | 1372 KB | Partially correct |
86 | Partially correct | 12 ms | 2140 KB | Partially correct |
87 | Partially correct | 83 ms | 14676 KB | Partially correct |
88 | Correct | 0 ms | 344 KB | Output is correct |
89 | Correct | 0 ms | 348 KB | Output is correct |
90 | Partially correct | 10 ms | 2184 KB | Partially correct |
91 | Partially correct | 99 ms | 14396 KB | Partially correct |
92 | Partially correct | 82 ms | 14600 KB | Partially correct |
93 | Partially correct | 23 ms | 4032 KB | Partially correct |
94 | Correct | 0 ms | 344 KB | Output is correct |
95 | Correct | 0 ms | 348 KB | Output is correct |
96 | Correct | 0 ms | 348 KB | Output is correct |
97 | Partially correct | 85 ms | 14668 KB | Partially correct |
98 | Partially correct | 83 ms | 14616 KB | Partially correct |
99 | Partially correct | 91 ms | 14948 KB | Partially correct |
100 | Partially correct | 85 ms | 14608 KB | Partially correct |
101 | Partially correct | 83 ms | 14604 KB | Partially correct |
102 | Partially correct | 87 ms | 14604 KB | Partially correct |
103 | Partially correct | 89 ms | 14696 KB | Partially correct |
104 | Partially correct | 88 ms | 14600 KB | Partially correct |
105 | Partially correct | 127 ms | 14600 KB | Partially correct |
106 | Partially correct | 106 ms | 14712 KB | Partially correct |
107 | Partially correct | 98 ms | 14584 KB | Partially correct |
108 | Partially correct | 97 ms | 14628 KB | Partially correct |
109 | Partially correct | 94 ms | 14728 KB | Partially correct |
110 | Partially correct | 90 ms | 14660 KB | Partially correct |
111 | Partially correct | 86 ms | 14676 KB | Partially correct |
112 | Partially correct | 89 ms | 14600 KB | Partially correct |
113 | Partially correct | 94 ms | 14708 KB | Partially correct |
114 | Partially correct | 95 ms | 14596 KB | Partially correct |
115 | Partially correct | 90 ms | 14600 KB | Partially correct |
116 | Correct | 0 ms | 348 KB | Output is correct |
117 | Correct | 0 ms | 348 KB | Output is correct |
118 | Correct | 0 ms | 348 KB | Output is correct |
119 | Correct | 0 ms | 348 KB | Output is correct |
120 | Correct | 0 ms | 344 KB | Output is correct |
121 | Correct | 0 ms | 348 KB | Output is correct |
122 | Correct | 0 ms | 348 KB | Output is correct |
123 | Correct | 0 ms | 348 KB | Output is correct |
124 | Correct | 0 ms | 348 KB | Output is correct |
125 | Correct | 0 ms | 348 KB | Output is correct |
126 | Correct | 0 ms | 348 KB | Output is correct |
127 | Correct | 0 ms | 348 KB | Output is correct |
128 | Correct | 0 ms | 348 KB | Output is correct |
129 | Correct | 0 ms | 348 KB | Output is correct |
130 | Correct | 0 ms | 348 KB | Output is correct |
131 | Correct | 0 ms | 348 KB | Output is correct |
132 | Correct | 0 ms | 344 KB | Output is correct |
133 | Correct | 0 ms | 348 KB | Output is correct |
134 | Correct | 0 ms | 348 KB | Output is correct |
135 | Correct | 0 ms | 348 KB | Output is correct |
136 | Correct | 0 ms | 348 KB | Output is correct |
137 | Correct | 0 ms | 348 KB | Output is correct |
138 | Correct | 0 ms | 348 KB | Output is correct |
139 | Correct | 0 ms | 348 KB | Output is correct |
140 | Partially correct | 88 ms | 14604 KB | Partially correct |
141 | Correct | 0 ms | 348 KB | Output is correct |
142 | Partially correct | 85 ms | 14652 KB | Partially correct |
143 | Partially correct | 86 ms | 14692 KB | Partially correct |
144 | Partially correct | 114 ms | 14860 KB | Partially correct |
145 | Partially correct | 92 ms | 14736 KB | Partially correct |
146 | Partially correct | 84 ms | 14604 KB | Partially correct |
147 | Partially correct | 90 ms | 14732 KB | Partially correct |
148 | Partially correct | 94 ms | 14712 KB | Partially correct |
149 | Partially correct | 101 ms | 14964 KB | Partially correct |
150 | Partially correct | 113 ms | 14596 KB | Partially correct |
151 | Partially correct | 103 ms | 14600 KB | Partially correct |
152 | Partially correct | 81 ms | 14600 KB | Partially correct |
153 | Partially correct | 102 ms | 14604 KB | Partially correct |
154 | Partially correct | 86 ms | 14604 KB | Partially correct |
155 | Partially correct | 95 ms | 14648 KB | Partially correct |
156 | Partially correct | 90 ms | 14856 KB | Partially correct |
157 | Partially correct | 90 ms | 14688 KB | Partially correct |
158 | Partially correct | 82 ms | 14728 KB | Partially correct |
159 | Partially correct | 84 ms | 14748 KB | Partially correct |
160 | Partially correct | 94 ms | 14688 KB | Partially correct |
161 | Partially correct | 86 ms | 14572 KB | Partially correct |
162 | Correct | 0 ms | 348 KB | Output is correct |
163 | Correct | 1 ms | 348 KB | Output is correct |
164 | Correct | 0 ms | 348 KB | Output is correct |
165 | Correct | 0 ms | 344 KB | Output is correct |