#include <bits/stdc++.h>
using namespace std;
const int mxN = 3007;
vector<int> g[mxN];
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, m;
cin >> n >> m;
for (int i = 0; i < m; ++i) {
int u, v;
cin >> u >> v;
g[u].push_back(v);
g[v].push_back(u);
}
set<int> left;
for (int u = 1; u <= n; ++u) {
left.insert(u);
}
set<int> check;
for (int u = 1; u <= n; ++u) {
if (!left.count(u)) {
continue;
}
check.insert(u);
for (auto v : g[u]) {
check.insert(v);
}
for (int v = 1; v <= n; ++v) {
if (!check.count(v) && left.count(v)) {
left.erase(u);
left.erase(v);
break;
}
}
check.clear();
}
auto it = left.begin();
for (int i = 0; i < n / 3; ++i) {
cout << *it << ' ';
if (i < n / 3 - 1) {
++it;
}
}
cout << "\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
604 KB |
Output is correct |
2 |
Correct |
25 ms |
1672 KB |
Output is correct |
3 |
Correct |
27 ms |
1880 KB |
Output is correct |
4 |
Correct |
26 ms |
1628 KB |
Output is correct |
5 |
Correct |
26 ms |
1588 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
1112 KB |
Output is correct |
2 |
Correct |
106 ms |
4820 KB |
Output is correct |
3 |
Correct |
111 ms |
4932 KB |
Output is correct |
4 |
Correct |
108 ms |
4952 KB |
Output is correct |
5 |
Correct |
108 ms |
4700 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
35 ms |
1624 KB |
Output is correct |
2 |
Correct |
265 ms |
11596 KB |
Output is correct |
3 |
Correct |
272 ms |
11344 KB |
Output is correct |
4 |
Correct |
275 ms |
11344 KB |
Output is correct |
5 |
Correct |
264 ms |
11604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
84 ms |
3744 KB |
Output is correct |
2 |
Correct |
367 ms |
16212 KB |
Output is correct |
3 |
Correct |
391 ms |
16088 KB |
Output is correct |
4 |
Correct |
379 ms |
16316 KB |
Output is correct |
5 |
Correct |
389 ms |
16420 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
246 ms |
11716 KB |
Output is correct |
2 |
Correct |
449 ms |
18032 KB |
Output is correct |
3 |
Correct |
493 ms |
18248 KB |
Output is correct |
4 |
Correct |
523 ms |
18032 KB |
Output is correct |
5 |
Correct |
487 ms |
18256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
455 ms |
15696 KB |
Output is correct |
2 |
Correct |
638 ms |
20748 KB |
Output is correct |
3 |
Correct |
673 ms |
20812 KB |
Output is correct |
4 |
Correct |
644 ms |
20564 KB |
Output is correct |
5 |
Correct |
658 ms |
20680 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
615 ms |
17672 KB |
Output is correct |
2 |
Correct |
750 ms |
33292 KB |
Output is correct |
3 |
Correct |
801 ms |
33108 KB |
Output is correct |
4 |
Correct |
781 ms |
33196 KB |
Output is correct |
5 |
Correct |
781 ms |
33500 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
745 ms |
19024 KB |
Output is correct |
2 |
Correct |
864 ms |
36656 KB |
Output is correct |
3 |
Correct |
944 ms |
36684 KB |
Output is correct |
4 |
Correct |
904 ms |
36708 KB |
Output is correct |
5 |
Correct |
932 ms |
36780 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
882 ms |
35964 KB |
Output is correct |
2 |
Correct |
993 ms |
40104 KB |
Output is correct |
3 |
Correct |
1090 ms |
40276 KB |
Output is correct |
4 |
Correct |
1085 ms |
40624 KB |
Output is correct |
5 |
Correct |
1061 ms |
40272 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1083 ms |
41372 KB |
Output is correct |
2 |
Correct |
1115 ms |
41812 KB |
Output is correct |
3 |
Correct |
1157 ms |
42096 KB |
Output is correct |
4 |
Correct |
1157 ms |
42100 KB |
Output is correct |
5 |
Correct |
1155 ms |
41884 KB |
Output is correct |