//#define LOCAL
#include <bits/stdc++.h>
#include <cassert>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define MAX 1010101
#define MAXQ 101010
#define INF 1'000'000'100'000'000'000
#define bb ' '
#define ln '\n'
#define Ln '\n'
#define MOD 1000000007
#define TC 1
#ifdef LOCAL
#define DEBUG(a) cout<<a
#define TEST true
#else
#define DEBUG(...) 1234
#define TEST false
#endif
vector<int> adj[MAX];
vector<pii> ansv;
int vis[MAX];
void dfs(int x) {
vis[x] = 1;
for (auto v : adj[x]) {
if (vis[v]) continue;
ansv.emplace_back(x, v);
dfs(v);
ansv.emplace_back(x, v);
}
}
signed main() {
ios::sync_with_stdio(false), cin.tie(0);
int N, M;
cin >> N >> M;
int i, j, a, b;
for (i = 0; i < M; i++) {
cin >> a >> b;
adj[a].push_back(b);
adj[b].push_back(a);
}
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) vis[j] = 0;
dfs(i);
}
cout << ansv.size() << ln;
assert(ansv.size() <= 20000);
for (i = 0; i < ansv.size(); i++) {
int cnt = 0;
for (j = 0; j < N; j++) {
if (j == ansv[i].first || j == ansv[i].second) cout << 0 << bb;
else cout << ++cnt << bb;
}
cout << ln;
}
}
Compilation message
Main.cpp: In function 'int main()':
Main.cpp:55:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
55 | for (i = 0; i < ansv.size(); i++) {
| ~~^~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
25688 KB |
Output is correct |
2 |
Correct |
3 ms |
25688 KB |
Output is correct |
3 |
Correct |
3 ms |
25692 KB |
Output is correct |
4 |
Partially correct |
79 ms |
31636 KB |
Partially correct |
5 |
Partially correct |
78 ms |
31928 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
25692 KB |
Output is correct |
2 |
Correct |
3 ms |
25692 KB |
Output is correct |
3 |
Correct |
3 ms |
25692 KB |
Output is correct |
4 |
Correct |
3 ms |
25692 KB |
Output is correct |
5 |
Correct |
3 ms |
25692 KB |
Output is correct |
6 |
Partially correct |
5 ms |
25948 KB |
Partially correct |
7 |
Partially correct |
8 ms |
26204 KB |
Partially correct |
8 |
Partially correct |
14 ms |
26524 KB |
Partially correct |
9 |
Partially correct |
92 ms |
31952 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
25692 KB |
Output is correct |
2 |
Correct |
3 ms |
25692 KB |
Output is correct |
3 |
Correct |
3 ms |
25692 KB |
Output is correct |
4 |
Partially correct |
12 ms |
26564 KB |
Partially correct |
5 |
Partially correct |
77 ms |
31564 KB |
Partially correct |
6 |
Partially correct |
76 ms |
31884 KB |
Partially correct |
7 |
Partially correct |
23 ms |
27480 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
25688 KB |
Output is correct |
2 |
Correct |
3 ms |
25688 KB |
Output is correct |
3 |
Correct |
3 ms |
25692 KB |
Output is correct |
4 |
Partially correct |
79 ms |
31636 KB |
Partially correct |
5 |
Partially correct |
78 ms |
31928 KB |
Partially correct |
6 |
Correct |
4 ms |
25692 KB |
Output is correct |
7 |
Correct |
3 ms |
25692 KB |
Output is correct |
8 |
Correct |
3 ms |
25692 KB |
Output is correct |
9 |
Partially correct |
12 ms |
26564 KB |
Partially correct |
10 |
Partially correct |
77 ms |
31564 KB |
Partially correct |
11 |
Partially correct |
76 ms |
31884 KB |
Partially correct |
12 |
Partially correct |
23 ms |
27480 KB |
Partially correct |
13 |
Correct |
3 ms |
25692 KB |
Output is correct |
14 |
Correct |
3 ms |
25692 KB |
Output is correct |
15 |
Correct |
4 ms |
25692 KB |
Output is correct |
16 |
Partially correct |
87 ms |
31552 KB |
Partially correct |
17 |
Partially correct |
84 ms |
31852 KB |
Partially correct |
18 |
Correct |
3 ms |
25692 KB |
Output is correct |
19 |
Correct |
3 ms |
25692 KB |
Output is correct |
20 |
Partially correct |
13 ms |
26652 KB |
Partially correct |
21 |
Partially correct |
81 ms |
31568 KB |
Partially correct |
22 |
Partially correct |
90 ms |
31896 KB |
Partially correct |
23 |
Partially correct |
30 ms |
27328 KB |
Partially correct |
24 |
Correct |
4 ms |
25816 KB |
Output is correct |
25 |
Correct |
3 ms |
25692 KB |
Output is correct |
26 |
Correct |
4 ms |
25900 KB |
Output is correct |
27 |
Partially correct |
87 ms |
31876 KB |
Partially correct |
28 |
Partially correct |
78 ms |
31824 KB |
Partially correct |
29 |
Partially correct |
80 ms |
31916 KB |
Partially correct |
30 |
Partially correct |
87 ms |
31796 KB |
Partially correct |
31 |
Partially correct |
79 ms |
31700 KB |
Partially correct |
32 |
Partially correct |
110 ms |
31700 KB |
Partially correct |
33 |
Partially correct |
76 ms |
31892 KB |
Partially correct |
34 |
Partially correct |
75 ms |
31928 KB |
Partially correct |
35 |
Partially correct |
81 ms |
31696 KB |
Partially correct |
36 |
Partially correct |
86 ms |
31920 KB |
Partially correct |
37 |
Partially correct |
79 ms |
31944 KB |
Partially correct |
38 |
Partially correct |
77 ms |
31700 KB |
Partially correct |
39 |
Partially correct |
76 ms |
31700 KB |
Partially correct |
40 |
Partially correct |
77 ms |
31700 KB |
Partially correct |
41 |
Partially correct |
82 ms |
31844 KB |
Partially correct |
42 |
Partially correct |
96 ms |
32104 KB |
Partially correct |
43 |
Partially correct |
80 ms |
31696 KB |
Partially correct |
44 |
Partially correct |
78 ms |
31812 KB |
Partially correct |
45 |
Partially correct |
75 ms |
31800 KB |
Partially correct |
46 |
Correct |
3 ms |
25692 KB |
Output is correct |
47 |
Correct |
3 ms |
25692 KB |
Output is correct |
48 |
Correct |
3 ms |
25692 KB |
Output is correct |
49 |
Correct |
3 ms |
25776 KB |
Output is correct |
50 |
Correct |
3 ms |
25692 KB |
Output is correct |
51 |
Correct |
3 ms |
25780 KB |
Output is correct |
52 |
Correct |
3 ms |
25692 KB |
Output is correct |
53 |
Correct |
4 ms |
25692 KB |
Output is correct |
54 |
Correct |
4 ms |
25788 KB |
Output is correct |
55 |
Correct |
4 ms |
25692 KB |
Output is correct |
56 |
Correct |
3 ms |
25692 KB |
Output is correct |
57 |
Correct |
4 ms |
25692 KB |
Output is correct |
58 |
Correct |
4 ms |
25688 KB |
Output is correct |
59 |
Correct |
3 ms |
25692 KB |
Output is correct |
60 |
Correct |
3 ms |
25792 KB |
Output is correct |
61 |
Correct |
3 ms |
25692 KB |
Output is correct |
62 |
Correct |
3 ms |
25776 KB |
Output is correct |
63 |
Correct |
3 ms |
25692 KB |
Output is correct |
64 |
Correct |
3 ms |
25692 KB |
Output is correct |
65 |
Correct |
3 ms |
25692 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
25688 KB |
Output is correct |
2 |
Correct |
3 ms |
25688 KB |
Output is correct |
3 |
Correct |
3 ms |
25692 KB |
Output is correct |
4 |
Partially correct |
79 ms |
31636 KB |
Partially correct |
5 |
Partially correct |
78 ms |
31928 KB |
Partially correct |
6 |
Correct |
4 ms |
25692 KB |
Output is correct |
7 |
Correct |
3 ms |
25692 KB |
Output is correct |
8 |
Correct |
3 ms |
25692 KB |
Output is correct |
9 |
Correct |
3 ms |
25692 KB |
Output is correct |
10 |
Correct |
3 ms |
25692 KB |
Output is correct |
11 |
Partially correct |
5 ms |
25948 KB |
Partially correct |
12 |
Partially correct |
8 ms |
26204 KB |
Partially correct |
13 |
Partially correct |
14 ms |
26524 KB |
Partially correct |
14 |
Partially correct |
92 ms |
31952 KB |
Partially correct |
15 |
Correct |
4 ms |
25692 KB |
Output is correct |
16 |
Correct |
3 ms |
25692 KB |
Output is correct |
17 |
Correct |
3 ms |
25692 KB |
Output is correct |
18 |
Partially correct |
12 ms |
26564 KB |
Partially correct |
19 |
Partially correct |
77 ms |
31564 KB |
Partially correct |
20 |
Partially correct |
76 ms |
31884 KB |
Partially correct |
21 |
Partially correct |
23 ms |
27480 KB |
Partially correct |
22 |
Correct |
3 ms |
25692 KB |
Output is correct |
23 |
Correct |
3 ms |
25692 KB |
Output is correct |
24 |
Correct |
4 ms |
25692 KB |
Output is correct |
25 |
Partially correct |
87 ms |
31552 KB |
Partially correct |
26 |
Partially correct |
84 ms |
31852 KB |
Partially correct |
27 |
Correct |
3 ms |
25692 KB |
Output is correct |
28 |
Correct |
3 ms |
25692 KB |
Output is correct |
29 |
Partially correct |
13 ms |
26652 KB |
Partially correct |
30 |
Partially correct |
81 ms |
31568 KB |
Partially correct |
31 |
Partially correct |
90 ms |
31896 KB |
Partially correct |
32 |
Partially correct |
30 ms |
27328 KB |
Partially correct |
33 |
Correct |
4 ms |
25816 KB |
Output is correct |
34 |
Correct |
3 ms |
25692 KB |
Output is correct |
35 |
Correct |
4 ms |
25900 KB |
Output is correct |
36 |
Partially correct |
87 ms |
31876 KB |
Partially correct |
37 |
Partially correct |
78 ms |
31824 KB |
Partially correct |
38 |
Partially correct |
80 ms |
31916 KB |
Partially correct |
39 |
Partially correct |
87 ms |
31796 KB |
Partially correct |
40 |
Partially correct |
79 ms |
31700 KB |
Partially correct |
41 |
Partially correct |
110 ms |
31700 KB |
Partially correct |
42 |
Partially correct |
76 ms |
31892 KB |
Partially correct |
43 |
Partially correct |
75 ms |
31928 KB |
Partially correct |
44 |
Partially correct |
81 ms |
31696 KB |
Partially correct |
45 |
Partially correct |
86 ms |
31920 KB |
Partially correct |
46 |
Partially correct |
79 ms |
31944 KB |
Partially correct |
47 |
Partially correct |
77 ms |
31700 KB |
Partially correct |
48 |
Partially correct |
76 ms |
31700 KB |
Partially correct |
49 |
Partially correct |
77 ms |
31700 KB |
Partially correct |
50 |
Partially correct |
82 ms |
31844 KB |
Partially correct |
51 |
Partially correct |
96 ms |
32104 KB |
Partially correct |
52 |
Partially correct |
80 ms |
31696 KB |
Partially correct |
53 |
Partially correct |
78 ms |
31812 KB |
Partially correct |
54 |
Partially correct |
75 ms |
31800 KB |
Partially correct |
55 |
Correct |
3 ms |
25692 KB |
Output is correct |
56 |
Correct |
3 ms |
25692 KB |
Output is correct |
57 |
Correct |
3 ms |
25692 KB |
Output is correct |
58 |
Correct |
3 ms |
25776 KB |
Output is correct |
59 |
Correct |
3 ms |
25692 KB |
Output is correct |
60 |
Correct |
3 ms |
25780 KB |
Output is correct |
61 |
Correct |
3 ms |
25692 KB |
Output is correct |
62 |
Correct |
4 ms |
25692 KB |
Output is correct |
63 |
Correct |
4 ms |
25788 KB |
Output is correct |
64 |
Correct |
4 ms |
25692 KB |
Output is correct |
65 |
Correct |
3 ms |
25692 KB |
Output is correct |
66 |
Correct |
4 ms |
25692 KB |
Output is correct |
67 |
Correct |
4 ms |
25688 KB |
Output is correct |
68 |
Correct |
3 ms |
25692 KB |
Output is correct |
69 |
Correct |
3 ms |
25792 KB |
Output is correct |
70 |
Correct |
3 ms |
25692 KB |
Output is correct |
71 |
Correct |
3 ms |
25776 KB |
Output is correct |
72 |
Correct |
3 ms |
25692 KB |
Output is correct |
73 |
Correct |
3 ms |
25692 KB |
Output is correct |
74 |
Correct |
3 ms |
25692 KB |
Output is correct |
75 |
Correct |
3 ms |
25692 KB |
Output is correct |
76 |
Correct |
4 ms |
25688 KB |
Output is correct |
77 |
Correct |
3 ms |
25692 KB |
Output is correct |
78 |
Partially correct |
73 ms |
31676 KB |
Partially correct |
79 |
Partially correct |
77 ms |
31824 KB |
Partially correct |
80 |
Correct |
4 ms |
25688 KB |
Output is correct |
81 |
Correct |
3 ms |
25692 KB |
Output is correct |
82 |
Correct |
4 ms |
25692 KB |
Output is correct |
83 |
Correct |
4 ms |
25688 KB |
Output is correct |
84 |
Partially correct |
6 ms |
25948 KB |
Partially correct |
85 |
Partially correct |
8 ms |
26204 KB |
Partially correct |
86 |
Partially correct |
13 ms |
26712 KB |
Partially correct |
87 |
Partially correct |
82 ms |
31952 KB |
Partially correct |
88 |
Correct |
4 ms |
25692 KB |
Output is correct |
89 |
Correct |
3 ms |
25692 KB |
Output is correct |
90 |
Partially correct |
13 ms |
26460 KB |
Partially correct |
91 |
Partially correct |
79 ms |
31808 KB |
Partially correct |
92 |
Partially correct |
76 ms |
31768 KB |
Partially correct |
93 |
Partially correct |
23 ms |
27328 KB |
Partially correct |
94 |
Correct |
4 ms |
25688 KB |
Output is correct |
95 |
Correct |
4 ms |
25692 KB |
Output is correct |
96 |
Correct |
3 ms |
25692 KB |
Output is correct |
97 |
Partially correct |
76 ms |
31896 KB |
Partially correct |
98 |
Partially correct |
95 ms |
31824 KB |
Partially correct |
99 |
Partially correct |
97 ms |
31884 KB |
Partially correct |
100 |
Partially correct |
82 ms |
31700 KB |
Partially correct |
101 |
Partially correct |
78 ms |
31796 KB |
Partially correct |
102 |
Partially correct |
75 ms |
31928 KB |
Partially correct |
103 |
Partially correct |
91 ms |
31796 KB |
Partially correct |
104 |
Partially correct |
81 ms |
31800 KB |
Partially correct |
105 |
Partially correct |
78 ms |
31812 KB |
Partially correct |
106 |
Partially correct |
78 ms |
31796 KB |
Partially correct |
107 |
Partially correct |
76 ms |
31704 KB |
Partially correct |
108 |
Partially correct |
76 ms |
31796 KB |
Partially correct |
109 |
Partially correct |
75 ms |
31800 KB |
Partially correct |
110 |
Partially correct |
76 ms |
31700 KB |
Partially correct |
111 |
Partially correct |
83 ms |
31796 KB |
Partially correct |
112 |
Partially correct |
81 ms |
31696 KB |
Partially correct |
113 |
Partially correct |
76 ms |
31700 KB |
Partially correct |
114 |
Partially correct |
76 ms |
31796 KB |
Partially correct |
115 |
Partially correct |
83 ms |
31856 KB |
Partially correct |
116 |
Correct |
4 ms |
25692 KB |
Output is correct |
117 |
Correct |
4 ms |
25692 KB |
Output is correct |
118 |
Correct |
5 ms |
25692 KB |
Output is correct |
119 |
Correct |
4 ms |
25688 KB |
Output is correct |
120 |
Correct |
3 ms |
25788 KB |
Output is correct |
121 |
Correct |
3 ms |
25692 KB |
Output is correct |
122 |
Correct |
3 ms |
25688 KB |
Output is correct |
123 |
Correct |
3 ms |
25692 KB |
Output is correct |
124 |
Correct |
3 ms |
25692 KB |
Output is correct |
125 |
Correct |
4 ms |
25692 KB |
Output is correct |
126 |
Correct |
3 ms |
25692 KB |
Output is correct |
127 |
Correct |
3 ms |
25692 KB |
Output is correct |
128 |
Correct |
4 ms |
25692 KB |
Output is correct |
129 |
Correct |
4 ms |
25688 KB |
Output is correct |
130 |
Correct |
3 ms |
25692 KB |
Output is correct |
131 |
Correct |
3 ms |
25688 KB |
Output is correct |
132 |
Correct |
3 ms |
25692 KB |
Output is correct |
133 |
Correct |
4 ms |
25944 KB |
Output is correct |
134 |
Correct |
4 ms |
25692 KB |
Output is correct |
135 |
Correct |
3 ms |
25692 KB |
Output is correct |
136 |
Correct |
3 ms |
25692 KB |
Output is correct |
137 |
Correct |
4 ms |
25692 KB |
Output is correct |
138 |
Correct |
3 ms |
25692 KB |
Output is correct |
139 |
Correct |
3 ms |
25904 KB |
Output is correct |
140 |
Partially correct |
76 ms |
31800 KB |
Partially correct |
141 |
Correct |
4 ms |
25688 KB |
Output is correct |
142 |
Partially correct |
77 ms |
31952 KB |
Partially correct |
143 |
Partially correct |
77 ms |
31952 KB |
Partially correct |
144 |
Partially correct |
80 ms |
31948 KB |
Partially correct |
145 |
Partially correct |
78 ms |
31932 KB |
Partially correct |
146 |
Partially correct |
77 ms |
31852 KB |
Partially correct |
147 |
Partially correct |
76 ms |
31952 KB |
Partially correct |
148 |
Partially correct |
77 ms |
31948 KB |
Partially correct |
149 |
Partially correct |
86 ms |
31864 KB |
Partially correct |
150 |
Partially correct |
77 ms |
31824 KB |
Partially correct |
151 |
Partially correct |
76 ms |
31784 KB |
Partially correct |
152 |
Partially correct |
77 ms |
31956 KB |
Partially correct |
153 |
Partially correct |
76 ms |
31700 KB |
Partially correct |
154 |
Partially correct |
81 ms |
31948 KB |
Partially correct |
155 |
Partially correct |
79 ms |
31800 KB |
Partially correct |
156 |
Partially correct |
77 ms |
31796 KB |
Partially correct |
157 |
Partially correct |
86 ms |
31796 KB |
Partially correct |
158 |
Partially correct |
90 ms |
31796 KB |
Partially correct |
159 |
Partially correct |
77 ms |
31956 KB |
Partially correct |
160 |
Partially correct |
77 ms |
31960 KB |
Partially correct |
161 |
Partially correct |
82 ms |
31700 KB |
Partially correct |
162 |
Correct |
3 ms |
25688 KB |
Output is correct |
163 |
Correct |
3 ms |
25816 KB |
Output is correct |
164 |
Correct |
3 ms |
25688 KB |
Output is correct |
165 |
Correct |
6 ms |
25692 KB |
Output is correct |