# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
926607 |
2024-02-13T12:27:56 Z |
vjudge1 |
Party (POI11_imp) |
C++17 |
|
1209 ms |
58528 KB |
#include <bits/stdc++.h>
using namespace std;
const int mxN = 5007;
vector<int> g[mxN];
int32_t main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, m;
cin >> n >> m;
for (int i = 0; i < m; ++i) {
int u, v;
cin >> u >> v;
g[u].push_back(v);
g[v].push_back(u);
}
set<int> left;
left.clear();
for (int u = 1; u <= n; ++u) {
left.insert(u);
}
for (int u = 1; u <= n; ++u) {
if (!left.count(u)) {
continue;
}
set<int> check = {u};
for (auto v : g[u]) {
check.insert(v);
}
for (int v = 1; v <= n; ++v) {
if (!check.count(v) && left.count(v)) {
left.erase(u);
left.erase(v);
break;
}
}
}
if ((int)left.size() < n / 3) {
cout << "1" << "\n";
return 0;
}
auto it = left.begin();
for (int i = 0; i < n / 3; ++i) {
cout << *it << ' ';
++it;
}
cout << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
1 ms |
856 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
604 KB |
Output is correct |
2 |
Correct |
25 ms |
1712 KB |
Output is correct |
3 |
Correct |
28 ms |
1628 KB |
Output is correct |
4 |
Correct |
28 ms |
1712 KB |
Output is correct |
5 |
Correct |
27 ms |
1696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
1372 KB |
Output is correct |
2 |
Correct |
100 ms |
4956 KB |
Output is correct |
3 |
Correct |
110 ms |
4944 KB |
Output is correct |
4 |
Correct |
109 ms |
4944 KB |
Output is correct |
5 |
Correct |
107 ms |
4944 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
1628 KB |
Output is correct |
2 |
Correct |
248 ms |
11680 KB |
Output is correct |
3 |
Correct |
261 ms |
11644 KB |
Output is correct |
4 |
Correct |
259 ms |
11544 KB |
Output is correct |
5 |
Correct |
282 ms |
11600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
82 ms |
3964 KB |
Output is correct |
2 |
Correct |
355 ms |
16388 KB |
Output is correct |
3 |
Correct |
387 ms |
16208 KB |
Output is correct |
4 |
Correct |
397 ms |
16188 KB |
Output is correct |
5 |
Correct |
384 ms |
16460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
269 ms |
11860 KB |
Output is correct |
2 |
Correct |
449 ms |
18100 KB |
Output is correct |
3 |
Correct |
512 ms |
18164 KB |
Output is correct |
4 |
Correct |
476 ms |
18080 KB |
Output is correct |
5 |
Correct |
498 ms |
18256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
448 ms |
15500 KB |
Output is correct |
2 |
Correct |
631 ms |
20796 KB |
Output is correct |
3 |
Correct |
657 ms |
20548 KB |
Output is correct |
4 |
Correct |
643 ms |
20516 KB |
Output is correct |
5 |
Correct |
650 ms |
20720 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
605 ms |
17872 KB |
Output is correct |
2 |
Correct |
745 ms |
33620 KB |
Output is correct |
3 |
Correct |
802 ms |
33576 KB |
Output is correct |
4 |
Correct |
778 ms |
33104 KB |
Output is correct |
5 |
Correct |
778 ms |
33616 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
735 ms |
19284 KB |
Output is correct |
2 |
Correct |
876 ms |
49624 KB |
Output is correct |
3 |
Correct |
944 ms |
49744 KB |
Output is correct |
4 |
Correct |
935 ms |
50032 KB |
Output is correct |
5 |
Correct |
930 ms |
49744 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
869 ms |
47556 KB |
Output is correct |
2 |
Correct |
1004 ms |
55444 KB |
Output is correct |
3 |
Correct |
1100 ms |
54864 KB |
Output is correct |
4 |
Correct |
1075 ms |
54940 KB |
Output is correct |
5 |
Correct |
1072 ms |
55120 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1091 ms |
55744 KB |
Output is correct |
2 |
Correct |
1084 ms |
57988 KB |
Output is correct |
3 |
Correct |
1209 ms |
58120 KB |
Output is correct |
4 |
Correct |
1164 ms |
58528 KB |
Output is correct |
5 |
Correct |
1153 ms |
58100 KB |
Output is correct |