#include <iostream>
#include <vector>
using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((b) < (a)) ? (b) : (a))
int const nmax = 3000;
int mat[1 + nmax][1 + nmax];
int sol[1 + nmax];
int main() {
std::ios::sync_with_stdio(0);
std::cin.tie(0);
int n, m;
std::cin >> n >> m;
for(int i = 1; i <= n; i++)
mat[i][i] = 1;
for(int i = 1; i <= m; i++) {
int x, y;
std::cin >> x >> y;
mat[x][y] = mat[y][x] = 1;
}
for(int i = 1; i <= n; i++)
sol[i] = 1;
for(int i = 1;i <= n; i++)
for(int j = 1;j <= n; j++)
if(mat[i][j] == 0 && sol[i] + sol[j] == 2)
sol[i] = sol[j] = 0;
int _count = 0;
for(int i = 1;i <= n; i++)
if(_count < n / 3 && sol[i] == 1) {
std::cout << i << " ";
_count++;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
512 KB |
Output is correct |
2 |
Correct |
1 ms |
512 KB |
Output is correct |
3 |
Correct |
2 ms |
768 KB |
Output is correct |
4 |
Correct |
1 ms |
768 KB |
Output is correct |
5 |
Correct |
1 ms |
768 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
1280 KB |
Output is correct |
2 |
Correct |
19 ms |
3328 KB |
Output is correct |
3 |
Correct |
19 ms |
3328 KB |
Output is correct |
4 |
Correct |
18 ms |
3328 KB |
Output is correct |
5 |
Correct |
18 ms |
3328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
2560 KB |
Output is correct |
2 |
Correct |
93 ms |
8192 KB |
Output is correct |
3 |
Correct |
95 ms |
8192 KB |
Output is correct |
4 |
Correct |
91 ms |
8192 KB |
Output is correct |
5 |
Correct |
96 ms |
8192 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
4096 KB |
Output is correct |
2 |
Correct |
258 ms |
15100 KB |
Output is correct |
3 |
Correct |
250 ms |
15112 KB |
Output is correct |
4 |
Correct |
259 ms |
15112 KB |
Output is correct |
5 |
Correct |
257 ms |
15096 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
70 ms |
7160 KB |
Output is correct |
2 |
Correct |
385 ms |
20384 KB |
Output is correct |
3 |
Correct |
369 ms |
20216 KB |
Output is correct |
4 |
Correct |
388 ms |
20228 KB |
Output is correct |
5 |
Correct |
373 ms |
20216 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
229 ms |
15096 KB |
Output is correct |
2 |
Correct |
466 ms |
23928 KB |
Output is correct |
3 |
Correct |
463 ms |
23800 KB |
Output is correct |
4 |
Correct |
463 ms |
23928 KB |
Output is correct |
5 |
Correct |
459 ms |
24184 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
419 ms |
23928 KB |
Output is correct |
2 |
Correct |
614 ms |
27344 KB |
Output is correct |
3 |
Correct |
624 ms |
27340 KB |
Output is correct |
4 |
Correct |
624 ms |
27264 KB |
Output is correct |
5 |
Correct |
625 ms |
27384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
550 ms |
27512 KB |
Output is correct |
2 |
Correct |
724 ms |
29688 KB |
Output is correct |
3 |
Correct |
729 ms |
29688 KB |
Output is correct |
4 |
Correct |
721 ms |
29688 KB |
Output is correct |
5 |
Correct |
723 ms |
29816 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
661 ms |
29688 KB |
Output is correct |
2 |
Correct |
869 ms |
32000 KB |
Output is correct |
3 |
Correct |
857 ms |
32060 KB |
Output is correct |
4 |
Correct |
855 ms |
32000 KB |
Output is correct |
5 |
Correct |
872 ms |
57464 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
761 ms |
32120 KB |
Output is correct |
2 |
Correct |
993 ms |
37196 KB |
Output is correct |
3 |
Correct |
1002 ms |
63992 KB |
Output is correct |
4 |
Correct |
1020 ms |
64136 KB |
Output is correct |
5 |
Correct |
1008 ms |
64116 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
950 ms |
36740 KB |
Output is correct |
2 |
Correct |
1074 ms |
65536 KB |
Output is correct |
3 |
Correct |
1070 ms |
65536 KB |
Output is correct |
4 |
Correct |
1087 ms |
65536 KB |
Output is correct |
5 |
Correct |
1076 ms |
65536 KB |
Output is correct |