#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define x first
#define y second
ll N, M, used[500005];
vector<ll> G[500005];
int main(){
cin.tie(0) -> sync_with_stdio(0);
cin >> N >> M;
for(ll i = 1; i <= M; i++){
ll u, v; cin >> u >> v;
G[u].push_back(v); G[v].push_back(u);
}
vector<ll> R;
for(ll i = 1; i <= N; i++){
if(used[i]) continue;
for(auto v : G[i]){
used[v] = 1;
}
R.push_back(i);
}
cout << R.size() << '\n';
for(auto e : R){
cout << e << ' ';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
110 ms |
40704 KB |
Output is correct |
2 |
Correct |
104 ms |
40644 KB |
Output is correct |
3 |
Correct |
6 ms |
12124 KB |
Output is correct |
4 |
Correct |
34 ms |
19088 KB |
Output is correct |
5 |
Correct |
67 ms |
38632 KB |
Output is correct |
6 |
Correct |
82 ms |
37616 KB |
Output is correct |
7 |
Correct |
71 ms |
39604 KB |
Output is correct |
8 |
Correct |
72 ms |
37164 KB |
Output is correct |
9 |
Correct |
193 ms |
44564 KB |
Output is correct |
10 |
Correct |
142 ms |
41668 KB |
Output is correct |
11 |
Correct |
146 ms |
44132 KB |
Output is correct |
12 |
Correct |
165 ms |
41704 KB |
Output is correct |
13 |
Correct |
132 ms |
42024 KB |
Output is correct |
14 |
Correct |
139 ms |
41928 KB |
Output is correct |
15 |
Correct |
132 ms |
42176 KB |
Output is correct |
16 |
Correct |
125 ms |
42180 KB |
Output is correct |
17 |
Correct |
34 ms |
20048 KB |
Output is correct |
18 |
Correct |
52 ms |
24152 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
96 ms |
40652 KB |
Output is correct |
2 |
Correct |
76 ms |
38332 KB |
Output is correct |
3 |
Correct |
82 ms |
38184 KB |
Output is correct |
4 |
Correct |
159 ms |
43464 KB |
Output is correct |
5 |
Correct |
217 ms |
42376 KB |
Output is correct |
6 |
Correct |
155 ms |
40640 KB |
Output is correct |
7 |
Correct |
121 ms |
40804 KB |
Output is correct |
8 |
Correct |
120 ms |
42180 KB |
Output is correct |
9 |
Correct |
111 ms |
42180 KB |
Output is correct |
10 |
Correct |
29 ms |
19660 KB |
Output is correct |
11 |
Correct |
26 ms |
17888 KB |
Output is correct |
12 |
Correct |
41 ms |
18020 KB |
Output is correct |
13 |
Correct |
109 ms |
39512 KB |
Output is correct |
14 |
Correct |
104 ms |
41236 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
12376 KB |
Output is correct |
2 |
Correct |
6 ms |
12380 KB |
Output is correct |
3 |
Correct |
6 ms |
12432 KB |
Output is correct |
4 |
Correct |
7 ms |
12320 KB |
Output is correct |
5 |
Correct |
6 ms |
12404 KB |
Output is correct |
6 |
Correct |
6 ms |
12632 KB |
Output is correct |
7 |
Correct |
6 ms |
12520 KB |
Output is correct |
8 |
Correct |
6 ms |
12456 KB |
Output is correct |
9 |
Correct |
6 ms |
12276 KB |
Output is correct |
10 |
Correct |
6 ms |
12120 KB |
Output is correct |
11 |
Correct |
5 ms |
12124 KB |
Output is correct |
12 |
Correct |
6 ms |
12380 KB |
Output is correct |
13 |
Correct |
6 ms |
12376 KB |
Output is correct |
14 |
Correct |
5 ms |
12124 KB |
Output is correct |
15 |
Correct |
6 ms |
12380 KB |
Output is correct |
16 |
Correct |
6 ms |
12380 KB |
Output is correct |
17 |
Correct |
6 ms |
12380 KB |
Output is correct |
18 |
Correct |
6 ms |
12280 KB |
Output is correct |
19 |
Correct |
6 ms |
12380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
110 ms |
40704 KB |
Output is correct |
2 |
Correct |
104 ms |
40644 KB |
Output is correct |
3 |
Correct |
6 ms |
12124 KB |
Output is correct |
4 |
Correct |
34 ms |
19088 KB |
Output is correct |
5 |
Correct |
67 ms |
38632 KB |
Output is correct |
6 |
Correct |
82 ms |
37616 KB |
Output is correct |
7 |
Correct |
71 ms |
39604 KB |
Output is correct |
8 |
Correct |
72 ms |
37164 KB |
Output is correct |
9 |
Correct |
193 ms |
44564 KB |
Output is correct |
10 |
Correct |
142 ms |
41668 KB |
Output is correct |
11 |
Correct |
146 ms |
44132 KB |
Output is correct |
12 |
Correct |
165 ms |
41704 KB |
Output is correct |
13 |
Correct |
132 ms |
42024 KB |
Output is correct |
14 |
Correct |
139 ms |
41928 KB |
Output is correct |
15 |
Correct |
132 ms |
42176 KB |
Output is correct |
16 |
Correct |
125 ms |
42180 KB |
Output is correct |
17 |
Correct |
34 ms |
20048 KB |
Output is correct |
18 |
Correct |
52 ms |
24152 KB |
Output is correct |
19 |
Correct |
96 ms |
40652 KB |
Output is correct |
20 |
Correct |
76 ms |
38332 KB |
Output is correct |
21 |
Correct |
82 ms |
38184 KB |
Output is correct |
22 |
Correct |
159 ms |
43464 KB |
Output is correct |
23 |
Correct |
217 ms |
42376 KB |
Output is correct |
24 |
Correct |
155 ms |
40640 KB |
Output is correct |
25 |
Correct |
121 ms |
40804 KB |
Output is correct |
26 |
Correct |
120 ms |
42180 KB |
Output is correct |
27 |
Correct |
111 ms |
42180 KB |
Output is correct |
28 |
Correct |
29 ms |
19660 KB |
Output is correct |
29 |
Correct |
26 ms |
17888 KB |
Output is correct |
30 |
Correct |
41 ms |
18020 KB |
Output is correct |
31 |
Correct |
109 ms |
39512 KB |
Output is correct |
32 |
Correct |
104 ms |
41236 KB |
Output is correct |
33 |
Correct |
6 ms |
12376 KB |
Output is correct |
34 |
Correct |
6 ms |
12380 KB |
Output is correct |
35 |
Correct |
6 ms |
12432 KB |
Output is correct |
36 |
Correct |
7 ms |
12320 KB |
Output is correct |
37 |
Correct |
6 ms |
12404 KB |
Output is correct |
38 |
Correct |
6 ms |
12632 KB |
Output is correct |
39 |
Correct |
6 ms |
12520 KB |
Output is correct |
40 |
Correct |
6 ms |
12456 KB |
Output is correct |
41 |
Correct |
6 ms |
12276 KB |
Output is correct |
42 |
Correct |
6 ms |
12120 KB |
Output is correct |
43 |
Correct |
5 ms |
12124 KB |
Output is correct |
44 |
Correct |
6 ms |
12380 KB |
Output is correct |
45 |
Correct |
6 ms |
12376 KB |
Output is correct |
46 |
Correct |
5 ms |
12124 KB |
Output is correct |
47 |
Correct |
6 ms |
12380 KB |
Output is correct |
48 |
Correct |
6 ms |
12380 KB |
Output is correct |
49 |
Correct |
6 ms |
12380 KB |
Output is correct |
50 |
Correct |
6 ms |
12280 KB |
Output is correct |
51 |
Correct |
6 ms |
12380 KB |
Output is correct |
52 |
Correct |
104 ms |
40836 KB |
Output is correct |
53 |
Correct |
70 ms |
38332 KB |
Output is correct |
54 |
Correct |
68 ms |
38328 KB |
Output is correct |
55 |
Correct |
161 ms |
43560 KB |
Output is correct |
56 |
Correct |
183 ms |
42444 KB |
Output is correct |
57 |
Correct |
143 ms |
40640 KB |
Output is correct |
58 |
Correct |
122 ms |
40896 KB |
Output is correct |
59 |
Correct |
115 ms |
42180 KB |
Output is correct |
60 |
Correct |
31 ms |
20308 KB |
Output is correct |
61 |
Correct |
27 ms |
17728 KB |
Output is correct |
62 |
Correct |
25 ms |
17876 KB |
Output is correct |
63 |
Correct |
120 ms |
39616 KB |
Output is correct |
64 |
Correct |
98 ms |
40348 KB |
Output is correct |
65 |
Correct |
30 ms |
18616 KB |
Output is correct |
66 |
Correct |
209 ms |
42692 KB |
Output is correct |
67 |
Correct |
158 ms |
42688 KB |
Output is correct |
68 |
Correct |
131 ms |
42080 KB |
Output is correct |
69 |
Correct |
33 ms |
20048 KB |
Output is correct |
70 |
Correct |
79 ms |
33184 KB |
Output is correct |