#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define pii pair<int,int>
#define vint vector<int>
#define vpii vector<pii>
#define pb push_back
#define se second
#define fi first
#define all(x) x.begin(), x.end()
#define graph vector<vint>
using namespace std;
const int N = (int)3000 + 69;
const int mod = 9999991;
const int naser = 3999, has_7 = 3662;
int INF = LLONG_MAX;
int power(int a, int bb) { int ans = 1;while (bb) { if (bb % 2) { ans *= a; }a *= a;bb /= 2; }return ans; }
int gcd(int a, int b) { if (b == 0)return a;return gcd(b, a % b); }
int edge[N][N] = {};
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, m;
cin >> n >> m;
set<int> ans;
for (int i = 1; i <= n; i++) {
ans.insert(i);
}
while (m--) {
int u, v;
cin >> u >> v;
edge[u][v] = 1;
edge[v][u] = 1;
}
for (int i = 1; i <= n; i++) {
for (int j = i + 1; j <= n; j++) {
if (!edge[i][j]) {
for (int k = 1; k <= n; k++) {
edge[i][k] = edge[k][i] = 1;
edge[j][k] = edge[k][j] = 1;
}
ans.erase(i), ans.erase(j);
}
}
}
int cnt = 0;
while (cnt < (int)n / 3) {
cout << *ans.begin() << ' ';
ans.erase(ans.begin());
cnt++;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
4440 KB |
Output is correct |
4 |
Correct |
1 ms |
4444 KB |
Output is correct |
5 |
Correct |
1 ms |
4444 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
6492 KB |
Output is correct |
2 |
Correct |
12 ms |
12856 KB |
Output is correct |
3 |
Correct |
12 ms |
13404 KB |
Output is correct |
4 |
Correct |
13 ms |
13352 KB |
Output is correct |
5 |
Correct |
12 ms |
13404 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
10588 KB |
Output is correct |
2 |
Correct |
48 ms |
25180 KB |
Output is correct |
3 |
Correct |
49 ms |
27984 KB |
Output is correct |
4 |
Correct |
51 ms |
27984 KB |
Output is correct |
5 |
Correct |
50 ms |
27880 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
14680 KB |
Output is correct |
2 |
Correct |
221 ms |
37468 KB |
Output is correct |
3 |
Correct |
167 ms |
44628 KB |
Output is correct |
4 |
Correct |
231 ms |
44592 KB |
Output is correct |
5 |
Correct |
183 ms |
44624 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
35 ms |
23132 KB |
Output is correct |
2 |
Correct |
328 ms |
43612 KB |
Output is correct |
3 |
Correct |
318 ms |
54352 KB |
Output is correct |
4 |
Correct |
349 ms |
54480 KB |
Output is correct |
5 |
Correct |
355 ms |
54444 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
215 ms |
37468 KB |
Output is correct |
2 |
Correct |
432 ms |
49912 KB |
Output is correct |
3 |
Correct |
450 ms |
63224 KB |
Output is correct |
4 |
Correct |
446 ms |
63360 KB |
Output is correct |
5 |
Correct |
449 ms |
63596 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
390 ms |
49756 KB |
Output is correct |
2 |
Correct |
617 ms |
55900 KB |
Output is correct |
3 |
Correct |
622 ms |
65536 KB |
Output is correct |
4 |
Correct |
628 ms |
65536 KB |
Output is correct |
5 |
Correct |
620 ms |
65536 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
543 ms |
56084 KB |
Output is correct |
2 |
Correct |
756 ms |
62288 KB |
Output is correct |
3 |
Correct |
711 ms |
65536 KB |
Output is correct |
4 |
Correct |
733 ms |
65536 KB |
Output is correct |
5 |
Correct |
785 ms |
65536 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
649 ms |
62044 KB |
Output is correct |
2 |
Runtime error |
19 ms |
65536 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
20 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
15 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |