#include <bits/stdc++.h>
using namespace std;
const int N = 3000;
int n, m;
bitset<N> adj[N];
bool in[N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n>>m;
for (int i = 0; i < n; i++) {
in[i] = 1;
for (int j = 0; j < n; j++)
adj[i][j] = 0;
}
for (int i = 0; i < m; i++) {
int a, b; cin>>a>>b;
adj[--a].set(--b);
adj[b].set(a);
}
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
if (i != j && adj[i][j] == 0 && in[i] && in[j])
in[i] = in[j] = 0;
stringstream ss;
for (int i = 0, cnt = 0; i < n; i++) {
if (in[i]) {
ss << i+1 << " ";
if (++cnt == n/3)
break;
}
}
cout << ss.str() << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
436 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
3 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
504 KB |
Output is correct |
2 |
Correct |
20 ms |
1272 KB |
Output is correct |
3 |
Correct |
21 ms |
1272 KB |
Output is correct |
4 |
Correct |
20 ms |
1272 KB |
Output is correct |
5 |
Correct |
21 ms |
1272 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
732 KB |
Output is correct |
2 |
Correct |
76 ms |
3704 KB |
Output is correct |
3 |
Correct |
77 ms |
3700 KB |
Output is correct |
4 |
Correct |
80 ms |
3632 KB |
Output is correct |
5 |
Correct |
78 ms |
3724 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
632 KB |
Output is correct |
2 |
Correct |
187 ms |
8292 KB |
Output is correct |
3 |
Correct |
189 ms |
8184 KB |
Output is correct |
4 |
Correct |
185 ms |
8184 KB |
Output is correct |
5 |
Correct |
187 ms |
8328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
56 ms |
760 KB |
Output is correct |
2 |
Correct |
271 ms |
11984 KB |
Output is correct |
3 |
Correct |
270 ms |
11768 KB |
Output is correct |
4 |
Correct |
271 ms |
11884 KB |
Output is correct |
5 |
Correct |
273 ms |
11916 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
166 ms |
1068 KB |
Output is correct |
2 |
Correct |
336 ms |
14744 KB |
Output is correct |
3 |
Correct |
334 ms |
14456 KB |
Output is correct |
4 |
Correct |
344 ms |
14600 KB |
Output is correct |
5 |
Correct |
338 ms |
14704 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
319 ms |
1380 KB |
Output is correct |
2 |
Correct |
449 ms |
19704 KB |
Output is correct |
3 |
Correct |
449 ms |
19336 KB |
Output is correct |
4 |
Correct |
450 ms |
19460 KB |
Output is correct |
5 |
Correct |
446 ms |
19452 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
401 ms |
1784 KB |
Output is correct |
2 |
Correct |
534 ms |
23248 KB |
Output is correct |
3 |
Correct |
528 ms |
22776 KB |
Output is correct |
4 |
Correct |
536 ms |
23160 KB |
Output is correct |
5 |
Correct |
535 ms |
22880 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
469 ms |
1352 KB |
Output is correct |
2 |
Correct |
634 ms |
27256 KB |
Output is correct |
3 |
Correct |
632 ms |
26692 KB |
Output is correct |
4 |
Correct |
620 ms |
26988 KB |
Output is correct |
5 |
Correct |
655 ms |
26484 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
555 ms |
2168 KB |
Output is correct |
2 |
Correct |
719 ms |
31180 KB |
Output is correct |
3 |
Correct |
719 ms |
30456 KB |
Output is correct |
4 |
Correct |
726 ms |
30796 KB |
Output is correct |
5 |
Correct |
728 ms |
30424 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
702 ms |
4900 KB |
Output is correct |
2 |
Correct |
789 ms |
33128 KB |
Output is correct |
3 |
Correct |
824 ms |
32936 KB |
Output is correct |
4 |
Correct |
794 ms |
33044 KB |
Output is correct |
5 |
Correct |
783 ms |
32900 KB |
Output is correct |