#include <iostream>
#include <vector>
#include <set>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<vector<bool> > g(n, vector<bool>(n, false));
for (int i = 0, a, b; i < m; i++)
{
cin >> a >> b;
a--, b--;
g[a][b] = g[b][a] = true;
}
vector<bool> alive(n, true);
for (int i = 0; i < n; i++) for (int j = 0; j < i; j++)
{
if (alive[i] && alive[j] && !g[i][j])
{
alive[i] = alive[j] = false;
}
}
vector<int> k;
for (int i = 0; i < n; i++) if (alive[i]) k.push_back(i);
for (int i = 0; i < n / 3; i++) cout << k[i] + 1 << " \n"[i == n / 3 - 1];
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
324 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
332 KB |
Output is correct |
2 |
Correct |
17 ms |
588 KB |
Output is correct |
3 |
Correct |
18 ms |
588 KB |
Output is correct |
4 |
Correct |
18 ms |
664 KB |
Output is correct |
5 |
Correct |
18 ms |
580 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
636 KB |
Output is correct |
2 |
Correct |
69 ms |
836 KB |
Output is correct |
3 |
Correct |
69 ms |
828 KB |
Output is correct |
4 |
Correct |
70 ms |
768 KB |
Output is correct |
5 |
Correct |
70 ms |
836 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
588 KB |
Output is correct |
2 |
Correct |
171 ms |
952 KB |
Output is correct |
3 |
Correct |
182 ms |
940 KB |
Output is correct |
4 |
Correct |
183 ms |
1088 KB |
Output is correct |
5 |
Correct |
169 ms |
960 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
57 ms |
968 KB |
Output is correct |
2 |
Correct |
253 ms |
1100 KB |
Output is correct |
3 |
Correct |
251 ms |
1464 KB |
Output is correct |
4 |
Correct |
286 ms |
1224 KB |
Output is correct |
5 |
Correct |
257 ms |
1172 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
155 ms |
968 KB |
Output is correct |
2 |
Correct |
341 ms |
1196 KB |
Output is correct |
3 |
Correct |
323 ms |
1284 KB |
Output is correct |
4 |
Correct |
320 ms |
1188 KB |
Output is correct |
5 |
Correct |
337 ms |
1304 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
284 ms |
1280 KB |
Output is correct |
2 |
Correct |
419 ms |
1500 KB |
Output is correct |
3 |
Correct |
421 ms |
1540 KB |
Output is correct |
4 |
Correct |
425 ms |
1412 KB |
Output is correct |
5 |
Correct |
449 ms |
1452 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
384 ms |
1456 KB |
Output is correct |
2 |
Correct |
492 ms |
1620 KB |
Output is correct |
3 |
Correct |
534 ms |
1592 KB |
Output is correct |
4 |
Correct |
497 ms |
1720 KB |
Output is correct |
5 |
Correct |
498 ms |
1620 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
444 ms |
1588 KB |
Output is correct |
2 |
Correct |
583 ms |
1732 KB |
Output is correct |
3 |
Correct |
590 ms |
1892 KB |
Output is correct |
4 |
Correct |
585 ms |
1712 KB |
Output is correct |
5 |
Correct |
585 ms |
1776 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
513 ms |
1712 KB |
Output is correct |
2 |
Correct |
667 ms |
1820 KB |
Output is correct |
3 |
Correct |
674 ms |
1976 KB |
Output is correct |
4 |
Correct |
677 ms |
1888 KB |
Output is correct |
5 |
Correct |
685 ms |
1860 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
680 ms |
29424 KB |
Output is correct |
2 |
Correct |
724 ms |
33588 KB |
Output is correct |
3 |
Correct |
798 ms |
33064 KB |
Output is correct |
4 |
Correct |
753 ms |
33348 KB |
Output is correct |
5 |
Correct |
791 ms |
33184 KB |
Output is correct |