#include <bits/stdc++.h>
#define ll 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 = n / 3;
while (cnt--) {
cout << *ans.begin() << ' ';
ans.erase(ans.begin());
}
}
Compilation message
imp.cpp:16:11: warning: overflow in conversion from 'long long int' to 'int' changes value from '9223372036854775807' to '-1' [-Woverflow]
16 | int INF = LLONG_MAX;
| ^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2392 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
4444 KB |
Output is correct |
2 |
Correct |
17 ms |
6676 KB |
Output is correct |
3 |
Correct |
12 ms |
7004 KB |
Output is correct |
4 |
Correct |
12 ms |
7004 KB |
Output is correct |
5 |
Correct |
11 ms |
7216 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
6488 KB |
Output is correct |
2 |
Correct |
42 ms |
12892 KB |
Output is correct |
3 |
Correct |
41 ms |
14672 KB |
Output is correct |
4 |
Correct |
41 ms |
14672 KB |
Output is correct |
5 |
Correct |
46 ms |
14708 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
8536 KB |
Output is correct |
2 |
Correct |
100 ms |
19036 KB |
Output is correct |
3 |
Correct |
108 ms |
22868 KB |
Output is correct |
4 |
Correct |
119 ms |
22864 KB |
Output is correct |
5 |
Correct |
124 ms |
22868 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
12892 KB |
Output is correct |
2 |
Correct |
155 ms |
23132 KB |
Output is correct |
3 |
Correct |
172 ms |
28784 KB |
Output is correct |
4 |
Correct |
260 ms |
28756 KB |
Output is correct |
5 |
Correct |
182 ms |
28752 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
118 ms |
19036 KB |
Output is correct |
2 |
Correct |
271 ms |
25320 KB |
Output is correct |
3 |
Correct |
276 ms |
32336 KB |
Output is correct |
4 |
Correct |
313 ms |
32404 KB |
Output is correct |
5 |
Correct |
385 ms |
32236 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
320 ms |
25320 KB |
Output is correct |
2 |
Correct |
465 ms |
29436 KB |
Output is correct |
3 |
Correct |
440 ms |
34388 KB |
Output is correct |
4 |
Correct |
499 ms |
34560 KB |
Output is correct |
5 |
Correct |
452 ms |
34132 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
453 ms |
29272 KB |
Output is correct |
2 |
Correct |
539 ms |
31500 KB |
Output is correct |
3 |
Correct |
552 ms |
34316 KB |
Output is correct |
4 |
Correct |
623 ms |
33620 KB |
Output is correct |
5 |
Correct |
564 ms |
33548 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
579 ms |
31496 KB |
Output is correct |
2 |
Correct |
668 ms |
33564 KB |
Output is correct |
3 |
Correct |
739 ms |
58908 KB |
Output is correct |
4 |
Correct |
806 ms |
58940 KB |
Output is correct |
5 |
Correct |
789 ms |
58960 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
624 ms |
33568 KB |
Output is correct |
2 |
Correct |
924 ms |
35628 KB |
Output is correct |
3 |
Correct |
922 ms |
65112 KB |
Output is correct |
4 |
Correct |
956 ms |
65036 KB |
Output is correct |
5 |
Correct |
923 ms |
64720 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
905 ms |
51500 KB |
Output is correct |
2 |
Correct |
977 ms |
48912 KB |
Output is correct |
3 |
Correct |
984 ms |
65536 KB |
Output is correct |
4 |
Correct |
996 ms |
65536 KB |
Output is correct |
5 |
Correct |
1014 ms |
65536 KB |
Output is correct |