# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1092897 |
2024-09-25T10:24:49 Z |
Pannda |
Meetings (JOI19_meetings) |
C++17 |
|
1055 ms |
1672 KB |
#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
void Solve(int n) {
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
auto work = [&](auto self, vector<int> dom) -> void {
shuffle(dom.begin(), dom.end(), rng);
int r = dom.back();
dom.pop_back();
vector<vector<int>> branches;
vector<int> heads;
for (int u : dom) {
bool found = false;
for (int i = 0; !found && i < heads.size(); i++) {
int get = Query(r, u, heads[i]);
if (get == r) {
// nothing
} else if (get == u) {
heads[i] = u;
branches[i].push_back(u);
found = true;
} else {
branches[i].push_back(u);
found = true;
}
}
if (!found) {
heads.push_back(u);
branches.push_back({u});
}
}
for (int u : heads) {
if (r < u) Bridge(r, u);
else Bridge(u, r);
}
for (vector<int> branch : branches) {
self(self, branch);
}
};
work(work, [&]() -> vector<int> {
vector<int> dom(n);
iota(dom.begin(), dom.end(), 0);
return dom;
}());
}
Compilation message
meetings.cpp: In lambda function:
meetings.cpp:18:41: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
18 | for (int i = 0; !found && i < heads.size(); i++) {
| ~~^~~~~~~~~~~~~~
meetings.cpp: In instantiation of 'Solve(int)::<lambda(auto:23, std::vector<int>)> [with auto:23 = Solve(int)::<lambda(auto:23, std::vector<int>)>]':
meetings.cpp:51:8: required from here
meetings.cpp:18:41: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
344 KB |
Output is correct |
23 |
Correct |
0 ms |
344 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
0 ms |
344 KB |
Output is correct |
26 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
1 ms |
344 KB |
Output is correct |
23 |
Correct |
0 ms |
344 KB |
Output is correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
0 ms |
344 KB |
Output is correct |
26 |
Correct |
0 ms |
344 KB |
Output is correct |
27 |
Correct |
10 ms |
600 KB |
Output is correct |
28 |
Correct |
18 ms |
600 KB |
Output is correct |
29 |
Correct |
14 ms |
600 KB |
Output is correct |
30 |
Correct |
17 ms |
600 KB |
Output is correct |
31 |
Correct |
16 ms |
600 KB |
Output is correct |
32 |
Correct |
17 ms |
600 KB |
Output is correct |
33 |
Correct |
25 ms |
600 KB |
Output is correct |
34 |
Correct |
36 ms |
860 KB |
Output is correct |
35 |
Correct |
28 ms |
728 KB |
Output is correct |
36 |
Correct |
11 ms |
344 KB |
Output is correct |
37 |
Correct |
8 ms |
344 KB |
Output is correct |
38 |
Correct |
7 ms |
344 KB |
Output is correct |
39 |
Correct |
6 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1055 ms |
1672 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |