#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;
int ct = 0;
for (int x : A) {
if (!adj[i][x]) g = false;
}
for (int j = 0; j < n; j++) {
ct += adj[i][j] && deg[i] >= n/3*2-1;
}
if (g && ct >= n/3*2-1) 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 |
11 ms |
896 KB |
Output is correct |
2 |
Incorrect |
79 ms |
1792 KB |
Wypisano za ma³o osób |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
45 ms |
1536 KB |
Output is correct |
2 |
Incorrect |
325 ms |
3320 KB |
Wypisano za ma³o osób |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
101 ms |
2168 KB |
Output is correct |
2 |
Incorrect |
796 ms |
4856 KB |
Wypisano za ma³o osób |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
230 ms |
3016 KB |
Output is correct |
2 |
Incorrect |
1177 ms |
5644 KB |
Wypisano za ma³o osób |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
715 ms |
4784 KB |
Wypisano za ma³o osób |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1356 ms |
6264 KB |
Output is correct |
2 |
Incorrect |
2029 ms |
7160 KB |
Wypisano za ma³o osób |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1788 ms |
7124 KB |
Output is correct |
2 |
Incorrect |
2476 ms |
7800 KB |
Wypisano za ma³o osób |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2126 ms |
7800 KB |
Output is correct |
2 |
Incorrect |
2835 ms |
8288 KB |
Wypisano za ma³o osób |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2464 ms |
8304 KB |
Output is correct |
2 |
Execution timed out |
3066 ms |
8852 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3071 ms |
9208 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |