#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<vector<int>> g;
vector<int> vis, depth;
void dfs(int v, int par){
vis[v] = 1;
if (par != -1) depth[v] = depth[par] + 1;
for (int u : g[v]){
if (u != par && vis[u] == 0){
dfs(u, v);
}
}
}
signed main(){
int n, m; cin >> n >> m;
g.clear();
g.resize(n + 1);
vis.clear();
vis.resize(n + 1);
depth.clear();
depth.resize(n + 1);
for (int i = 0; i < m; i++){
int a, b; cin >> a >> b;
g[a].push_back(b);
g[b].push_back(a);
}
int root = 0;
/*for (int i = 0; i < n; i++){
if ((long long)(g[i].size()) == 1) {
root = i;
break;
}
}*/
depth[root] = 0;
dfs(root, -1);
cout << 3*6000 << endl;
for (int k = 0; k < 6000; k++){
for (int i = 0; i < n; i++){
cout << depth[i] / 2 << ' ';
}
cout << endl;
for (int i = 0; i < n; i++){
cout << (depth[i] + 1) / 2 << ' ';
}
cout << endl;
bool f = 0;
for (int i = 0; i < n; i++){
if (depth[i] == 0) {
cout << n << ' ';
continue;
}
if (depth[i] == 1 && !f){
cout << n << ' ';
f = 1;
continue;
}
cout << i << ' ';
}
cout << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
20 ms |
344 KB |
Partially correct |
2 |
Partially correct |
21 ms |
348 KB |
Partially correct |
3 |
Partially correct |
21 ms |
348 KB |
Partially correct |
4 |
Partially correct |
107 ms |
4392 KB |
Partially correct |
5 |
Partially correct |
111 ms |
4432 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
19 ms |
600 KB |
Partially correct |
2 |
Partially correct |
21 ms |
348 KB |
Partially correct |
3 |
Partially correct |
21 ms |
504 KB |
Partially correct |
4 |
Partially correct |
27 ms |
600 KB |
Partially correct |
5 |
Partially correct |
36 ms |
1104 KB |
Partially correct |
6 |
Partially correct |
46 ms |
1664 KB |
Partially correct |
7 |
Partially correct |
61 ms |
2128 KB |
Partially correct |
8 |
Partially correct |
71 ms |
2700 KB |
Partially correct |
9 |
Partially correct |
114 ms |
5516 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
27 ms |
508 KB |
Partially correct |
2 |
Partially correct |
20 ms |
348 KB |
Partially correct |
3 |
Partially correct |
22 ms |
348 KB |
Partially correct |
4 |
Partially correct |
62 ms |
2640 KB |
Partially correct |
5 |
Partially correct |
106 ms |
5712 KB |
Partially correct |
6 |
Partially correct |
112 ms |
5456 KB |
Partially correct |
7 |
Partially correct |
79 ms |
3464 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
20 ms |
344 KB |
Partially correct |
2 |
Partially correct |
21 ms |
348 KB |
Partially correct |
3 |
Partially correct |
21 ms |
348 KB |
Partially correct |
4 |
Partially correct |
107 ms |
4392 KB |
Partially correct |
5 |
Partially correct |
111 ms |
4432 KB |
Partially correct |
6 |
Partially correct |
27 ms |
508 KB |
Partially correct |
7 |
Partially correct |
20 ms |
348 KB |
Partially correct |
8 |
Partially correct |
22 ms |
348 KB |
Partially correct |
9 |
Partially correct |
62 ms |
2640 KB |
Partially correct |
10 |
Partially correct |
106 ms |
5712 KB |
Partially correct |
11 |
Partially correct |
112 ms |
5456 KB |
Partially correct |
12 |
Partially correct |
79 ms |
3464 KB |
Partially correct |
13 |
Partially correct |
20 ms |
620 KB |
Partially correct |
14 |
Partially correct |
20 ms |
348 KB |
Partially correct |
15 |
Partially correct |
23 ms |
344 KB |
Partially correct |
16 |
Partially correct |
135 ms |
4436 KB |
Partially correct |
17 |
Partially correct |
109 ms |
4468 KB |
Partially correct |
18 |
Partially correct |
21 ms |
348 KB |
Partially correct |
19 |
Partially correct |
21 ms |
344 KB |
Partially correct |
20 |
Partially correct |
62 ms |
2796 KB |
Partially correct |
21 |
Partially correct |
107 ms |
5308 KB |
Partially correct |
22 |
Partially correct |
110 ms |
5440 KB |
Partially correct |
23 |
Partially correct |
78 ms |
3564 KB |
Partially correct |
24 |
Partially correct |
27 ms |
604 KB |
Partially correct |
25 |
Incorrect |
27 ms |
604 KB |
If people start at 0 and 2, then they can avoid each other |
26 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
20 ms |
344 KB |
Partially correct |
2 |
Partially correct |
21 ms |
348 KB |
Partially correct |
3 |
Partially correct |
21 ms |
348 KB |
Partially correct |
4 |
Partially correct |
107 ms |
4392 KB |
Partially correct |
5 |
Partially correct |
111 ms |
4432 KB |
Partially correct |
6 |
Partially correct |
19 ms |
600 KB |
Partially correct |
7 |
Partially correct |
21 ms |
348 KB |
Partially correct |
8 |
Partially correct |
21 ms |
504 KB |
Partially correct |
9 |
Partially correct |
27 ms |
600 KB |
Partially correct |
10 |
Partially correct |
36 ms |
1104 KB |
Partially correct |
11 |
Partially correct |
46 ms |
1664 KB |
Partially correct |
12 |
Partially correct |
61 ms |
2128 KB |
Partially correct |
13 |
Partially correct |
71 ms |
2700 KB |
Partially correct |
14 |
Partially correct |
114 ms |
5516 KB |
Partially correct |
15 |
Partially correct |
27 ms |
508 KB |
Partially correct |
16 |
Partially correct |
20 ms |
348 KB |
Partially correct |
17 |
Partially correct |
22 ms |
348 KB |
Partially correct |
18 |
Partially correct |
62 ms |
2640 KB |
Partially correct |
19 |
Partially correct |
106 ms |
5712 KB |
Partially correct |
20 |
Partially correct |
112 ms |
5456 KB |
Partially correct |
21 |
Partially correct |
79 ms |
3464 KB |
Partially correct |
22 |
Partially correct |
20 ms |
620 KB |
Partially correct |
23 |
Partially correct |
20 ms |
348 KB |
Partially correct |
24 |
Partially correct |
23 ms |
344 KB |
Partially correct |
25 |
Partially correct |
135 ms |
4436 KB |
Partially correct |
26 |
Partially correct |
109 ms |
4468 KB |
Partially correct |
27 |
Partially correct |
21 ms |
348 KB |
Partially correct |
28 |
Partially correct |
21 ms |
344 KB |
Partially correct |
29 |
Partially correct |
62 ms |
2796 KB |
Partially correct |
30 |
Partially correct |
107 ms |
5308 KB |
Partially correct |
31 |
Partially correct |
110 ms |
5440 KB |
Partially correct |
32 |
Partially correct |
78 ms |
3564 KB |
Partially correct |
33 |
Partially correct |
27 ms |
604 KB |
Partially correct |
34 |
Incorrect |
27 ms |
604 KB |
If people start at 0 and 2, then they can avoid each other |
35 |
Halted |
0 ms |
0 KB |
- |