#include <bits/stdc++.h>
using namespace std;
#define pb push_back
bool adj[3000][3000];
int deg[3000];
int main() {
int n, m; cin >> n >> m;
for (int i = 0; i < m; i++) {
int a, b; cin >> a >> b; --a; --b;
deg[a]++; deg[b]++;
adj[a][b] = 1; adj[b][a] = 1;
}
vector<int> A;
for (int i = 0; i < n; i++) {
if (deg[i] >= n/3*2-1) {
bool g = true;
for (int x : A) {
if (!adj[i][x]) g = false;
}
if (g) A.pb(i);
}
if ((int)A.size() == n/3) break;
}
for (int x : A) cout << x+1 << " ";
cout << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
512 KB |
Output is correct |
3 |
Correct |
3 ms |
640 KB |
Output is correct |
4 |
Correct |
3 ms |
640 KB |
Output is correct |
5 |
Correct |
3 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
1060 KB |
Output is correct |
2 |
Incorrect |
79 ms |
2304 KB |
Wypisano za ma³o osób |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
1912 KB |
Output is correct |
2 |
Incorrect |
328 ms |
3712 KB |
Wypisano za ma³o osób |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
100 ms |
2560 KB |
Output is correct |
2 |
Incorrect |
788 ms |
5112 KB |
Wypisano za ma³o osób |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
237 ms |
3448 KB |
Output is correct |
2 |
Incorrect |
1297 ms |
6136 KB |
Wypisano za ma³o osób |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
726 ms |
5112 KB |
Wypisano za ma³o osób |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1313 ms |
6520 KB |
Output is correct |
2 |
Incorrect |
2025 ms |
7288 KB |
Wypisano za ma³o osób |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1764 ms |
7404 KB |
Output is correct |
2 |
Incorrect |
2400 ms |
7964 KB |
Wypisano za ma³o osób |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2122 ms |
7928 KB |
Output is correct |
2 |
Incorrect |
2832 ms |
8476 KB |
Wypisano za ma³o osób |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2515 ms |
8360 KB |
Output is correct |
2 |
Execution timed out |
3023 ms |
8832 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3054 ms |
9848 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |