#include "meetings.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 2e3+5;
void connect(int a, int b) {
if(a > b) swap(a, b);
Bridge(a, b);
}
vector<int> sub[N];
void solve(vector<int> vec) {
if(vec.size() < 2) return;
for(int x : vec) sub[x].clear();
int a = vec[0], b = vec[1];
vector<int> path;
for(int i = 2; i < vec.size(); i++) {
int now = Query(a, b, vec[i]);
sub[now].emplace_back(vec[i]);
if(now == vec[i]) path.emplace_back(now);
}
sub[a].emplace_back(a), sub[b].emplace_back(b);
sort(path.begin(), path.end(), [&](int x, int y) {
return Query(x, y, b) == y;
});
path.insert(path.begin(), a), path.emplace_back(b);
for(int i = 0; i < path.size() - 1; i++)
connect(path[i], path[i + 1]);
for(int x : path) solve(sub[x]);
}
void Solve(int n) {
vector<int> vec;
for(int i = 0; i < n; i++) vec.emplace_back(i);
solve(vec);
}
Compilation message
meetings.cpp: In function 'void solve(std::vector<int>)':
meetings.cpp:21:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 2; i < vec.size(); i++) {
~~^~~~~~~~~~~~
meetings.cpp:31:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < path.size() - 1; i++)
~~^~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
6 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
5 ms |
384 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
5 ms |
512 KB |
Output is correct |
22 |
Correct |
5 ms |
384 KB |
Output is correct |
23 |
Correct |
5 ms |
384 KB |
Output is correct |
24 |
Correct |
5 ms |
384 KB |
Output is correct |
25 |
Correct |
5 ms |
384 KB |
Output is correct |
26 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
6 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
5 ms |
384 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
5 ms |
512 KB |
Output is correct |
22 |
Correct |
5 ms |
384 KB |
Output is correct |
23 |
Correct |
5 ms |
384 KB |
Output is correct |
24 |
Correct |
5 ms |
384 KB |
Output is correct |
25 |
Correct |
5 ms |
384 KB |
Output is correct |
26 |
Correct |
5 ms |
384 KB |
Output is correct |
27 |
Correct |
9 ms |
512 KB |
Output is correct |
28 |
Correct |
9 ms |
512 KB |
Output is correct |
29 |
Correct |
10 ms |
512 KB |
Output is correct |
30 |
Correct |
9 ms |
512 KB |
Output is correct |
31 |
Correct |
9 ms |
512 KB |
Output is correct |
32 |
Correct |
10 ms |
512 KB |
Output is correct |
33 |
Correct |
12 ms |
516 KB |
Output is correct |
34 |
Correct |
14 ms |
520 KB |
Output is correct |
35 |
Correct |
13 ms |
512 KB |
Output is correct |
36 |
Correct |
9 ms |
512 KB |
Output is correct |
37 |
Correct |
12 ms |
512 KB |
Output is correct |
38 |
Correct |
14 ms |
512 KB |
Output is correct |
39 |
Correct |
85 ms |
760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
447 ms |
888 KB |
Output is correct |
2 |
Correct |
486 ms |
760 KB |
Output is correct |
3 |
Correct |
513 ms |
888 KB |
Output is correct |
4 |
Correct |
477 ms |
760 KB |
Output is correct |
5 |
Correct |
347 ms |
760 KB |
Output is correct |
6 |
Correct |
374 ms |
888 KB |
Output is correct |
7 |
Correct |
399 ms |
1144 KB |
Output is correct |
8 |
Correct |
426 ms |
888 KB |
Output is correct |
9 |
Correct |
425 ms |
760 KB |
Output is correct |
10 |
Correct |
427 ms |
760 KB |
Output is correct |
11 |
Correct |
496 ms |
760 KB |
Output is correct |
12 |
Correct |
485 ms |
1144 KB |
Output is correct |
13 |
Correct |
311 ms |
760 KB |
Output is correct |
14 |
Correct |
441 ms |
888 KB |
Output is correct |
15 |
Correct |
276 ms |
760 KB |
Output is correct |
16 |
Correct |
340 ms |
888 KB |
Output is correct |
17 |
Correct |
470 ms |
760 KB |
Output is correct |
18 |
Execution timed out |
2343 ms |
1312 KB |
Time limit exceeded |
19 |
Halted |
0 ms |
0 KB |
- |