# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1029332 |
2024-07-20T16:55:58 Z |
Blagoj |
Meetings (JOI19_meetings) |
C++17 |
|
683 ms |
16004 KB |
#include <bits/stdc++.h>
#include "meetings.h"
using namespace std;
#define endl '\n'
#define ll long long
#define all(x) (x).begin(), (x).end()
const int mxn = 2e4 + 100;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int> C[mxn];
void merge(int a, int b) {
Bridge(min(a, b), max(a, b));
}
void solve(vector<int> v) {
int n = v.size();
if (n < 2) return;
shuffle(all(v), rng);
int x = v[0], y = v[1];
vector<int> between;
C[x].push_back(x);
C[y].push_back(y);
for (int i = 2; i < n; i++) {
int val = Query(x, y, v[i]);
if (val == v[i]) between.push_back(v[i]);
C[val].push_back(v[i]);
}
sort(all(between), [&] (int a, int b) {
return Query(x, a, b) == a;
});
between.insert(between.begin(), x);
between.push_back(y);
for (int i = 1; i < between.size(); i++) merge(between[i - 1], between[i]);
vector<vector<int>> toDo;
for (auto el : C) toDo.push_back(el);
for (auto el : between) C[el].clear();
for (auto el : toDo) solve(el);
}
void Solve(int N) {
vector<int> v;
for (int i = 0; i < N; i++) v.push_back(i);
solve(v);
}
Compilation message
meetings.cpp: In function 'void solve(std::vector<int>)':
meetings.cpp:39:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
39 | for (int i = 1; i < between.size(); i++) merge(between[i - 1], between[i]);
| ~~^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1624 KB |
Output is correct |
2 |
Correct |
2 ms |
2904 KB |
Output is correct |
3 |
Correct |
2 ms |
2516 KB |
Output is correct |
4 |
Correct |
1 ms |
2516 KB |
Output is correct |
5 |
Correct |
3 ms |
3548 KB |
Output is correct |
6 |
Correct |
2 ms |
2688 KB |
Output is correct |
7 |
Correct |
3 ms |
3548 KB |
Output is correct |
8 |
Correct |
2 ms |
2904 KB |
Output is correct |
9 |
Correct |
3 ms |
3844 KB |
Output is correct |
10 |
Correct |
3 ms |
2904 KB |
Output is correct |
11 |
Correct |
3 ms |
3292 KB |
Output is correct |
12 |
Correct |
1 ms |
1880 KB |
Output is correct |
13 |
Correct |
2 ms |
2992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1624 KB |
Output is correct |
2 |
Correct |
2 ms |
2904 KB |
Output is correct |
3 |
Correct |
2 ms |
2516 KB |
Output is correct |
4 |
Correct |
1 ms |
2516 KB |
Output is correct |
5 |
Correct |
3 ms |
3548 KB |
Output is correct |
6 |
Correct |
2 ms |
2688 KB |
Output is correct |
7 |
Correct |
3 ms |
3548 KB |
Output is correct |
8 |
Correct |
2 ms |
2904 KB |
Output is correct |
9 |
Correct |
3 ms |
3844 KB |
Output is correct |
10 |
Correct |
3 ms |
2904 KB |
Output is correct |
11 |
Correct |
3 ms |
3292 KB |
Output is correct |
12 |
Correct |
1 ms |
1880 KB |
Output is correct |
13 |
Correct |
2 ms |
2992 KB |
Output is correct |
14 |
Correct |
13 ms |
4824 KB |
Output is correct |
15 |
Correct |
12 ms |
4840 KB |
Output is correct |
16 |
Correct |
12 ms |
5428 KB |
Output is correct |
17 |
Correct |
13 ms |
6208 KB |
Output is correct |
18 |
Correct |
13 ms |
5004 KB |
Output is correct |
19 |
Correct |
12 ms |
6748 KB |
Output is correct |
20 |
Correct |
12 ms |
7624 KB |
Output is correct |
21 |
Correct |
13 ms |
6796 KB |
Output is correct |
22 |
Correct |
12 ms |
7132 KB |
Output is correct |
23 |
Correct |
10 ms |
4964 KB |
Output is correct |
24 |
Correct |
8 ms |
4784 KB |
Output is correct |
25 |
Correct |
8 ms |
4108 KB |
Output is correct |
26 |
Correct |
5 ms |
3964 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1624 KB |
Output is correct |
2 |
Correct |
2 ms |
2904 KB |
Output is correct |
3 |
Correct |
2 ms |
2516 KB |
Output is correct |
4 |
Correct |
1 ms |
2516 KB |
Output is correct |
5 |
Correct |
3 ms |
3548 KB |
Output is correct |
6 |
Correct |
2 ms |
2688 KB |
Output is correct |
7 |
Correct |
3 ms |
3548 KB |
Output is correct |
8 |
Correct |
2 ms |
2904 KB |
Output is correct |
9 |
Correct |
3 ms |
3844 KB |
Output is correct |
10 |
Correct |
3 ms |
2904 KB |
Output is correct |
11 |
Correct |
3 ms |
3292 KB |
Output is correct |
12 |
Correct |
1 ms |
1880 KB |
Output is correct |
13 |
Correct |
2 ms |
2992 KB |
Output is correct |
14 |
Correct |
13 ms |
4824 KB |
Output is correct |
15 |
Correct |
12 ms |
4840 KB |
Output is correct |
16 |
Correct |
12 ms |
5428 KB |
Output is correct |
17 |
Correct |
13 ms |
6208 KB |
Output is correct |
18 |
Correct |
13 ms |
5004 KB |
Output is correct |
19 |
Correct |
12 ms |
6748 KB |
Output is correct |
20 |
Correct |
12 ms |
7624 KB |
Output is correct |
21 |
Correct |
13 ms |
6796 KB |
Output is correct |
22 |
Correct |
12 ms |
7132 KB |
Output is correct |
23 |
Correct |
10 ms |
4964 KB |
Output is correct |
24 |
Correct |
8 ms |
4784 KB |
Output is correct |
25 |
Correct |
8 ms |
4108 KB |
Output is correct |
26 |
Correct |
5 ms |
3964 KB |
Output is correct |
27 |
Correct |
60 ms |
6992 KB |
Output is correct |
28 |
Correct |
63 ms |
7832 KB |
Output is correct |
29 |
Correct |
59 ms |
7796 KB |
Output is correct |
30 |
Correct |
56 ms |
6292 KB |
Output is correct |
31 |
Correct |
57 ms |
5952 KB |
Output is correct |
32 |
Correct |
65 ms |
7332 KB |
Output is correct |
33 |
Correct |
72 ms |
12508 KB |
Output is correct |
34 |
Correct |
90 ms |
12156 KB |
Output is correct |
35 |
Correct |
70 ms |
11140 KB |
Output is correct |
36 |
Correct |
57 ms |
5604 KB |
Output is correct |
37 |
Correct |
24 ms |
7388 KB |
Output is correct |
38 |
Correct |
26 ms |
7472 KB |
Output is correct |
39 |
Correct |
28 ms |
6404 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
510 ms |
8776 KB |
Output is correct |
2 |
Correct |
521 ms |
8636 KB |
Output is correct |
3 |
Correct |
501 ms |
8464 KB |
Output is correct |
4 |
Correct |
515 ms |
8652 KB |
Output is correct |
5 |
Correct |
488 ms |
8184 KB |
Output is correct |
6 |
Correct |
494 ms |
10368 KB |
Output is correct |
7 |
Correct |
616 ms |
12324 KB |
Output is correct |
8 |
Correct |
682 ms |
13348 KB |
Output is correct |
9 |
Correct |
642 ms |
14504 KB |
Output is correct |
10 |
Correct |
629 ms |
15648 KB |
Output is correct |
11 |
Correct |
635 ms |
12848 KB |
Output is correct |
12 |
Correct |
415 ms |
7136 KB |
Output is correct |
13 |
Correct |
461 ms |
7580 KB |
Output is correct |
14 |
Correct |
459 ms |
10176 KB |
Output is correct |
15 |
Correct |
460 ms |
11392 KB |
Output is correct |
16 |
Correct |
502 ms |
10952 KB |
Output is correct |
17 |
Correct |
559 ms |
14636 KB |
Output is correct |
18 |
Correct |
554 ms |
12160 KB |
Output is correct |
19 |
Correct |
582 ms |
13024 KB |
Output is correct |
20 |
Correct |
524 ms |
11180 KB |
Output is correct |
21 |
Correct |
534 ms |
12892 KB |
Output is correct |
22 |
Correct |
505 ms |
10844 KB |
Output is correct |
23 |
Correct |
571 ms |
10836 KB |
Output is correct |
24 |
Correct |
523 ms |
11840 KB |
Output is correct |
25 |
Correct |
633 ms |
13080 KB |
Output is correct |
26 |
Correct |
486 ms |
12436 KB |
Output is correct |
27 |
Correct |
462 ms |
13336 KB |
Output is correct |
28 |
Correct |
631 ms |
12980 KB |
Output is correct |
29 |
Correct |
639 ms |
15904 KB |
Output is correct |
30 |
Correct |
620 ms |
14280 KB |
Output is correct |
31 |
Correct |
683 ms |
16004 KB |
Output is correct |
32 |
Correct |
360 ms |
9284 KB |
Output is correct |
33 |
Correct |
362 ms |
8820 KB |
Output is correct |
34 |
Correct |
54 ms |
7776 KB |
Output is correct |
35 |
Correct |
54 ms |
6588 KB |
Output is correct |
36 |
Correct |
60 ms |
6476 KB |
Output is correct |
37 |
Correct |
66 ms |
7364 KB |
Output is correct |
38 |
Correct |
64 ms |
6060 KB |
Output is correct |
39 |
Correct |
66 ms |
7956 KB |
Output is correct |
40 |
Correct |
68 ms |
11192 KB |
Output is correct |
41 |
Correct |
77 ms |
11164 KB |
Output is correct |
42 |
Correct |
70 ms |
11568 KB |
Output is correct |
43 |
Correct |
65 ms |
6456 KB |
Output is correct |
44 |
Correct |
19 ms |
5296 KB |
Output is correct |
45 |
Correct |
26 ms |
6108 KB |
Output is correct |
46 |
Correct |
20 ms |
5432 KB |
Output is correct |
47 |
Correct |
12 ms |
4544 KB |
Output is correct |
48 |
Correct |
10 ms |
5776 KB |
Output is correct |
49 |
Correct |
15 ms |
4988 KB |
Output is correct |
50 |
Correct |
18 ms |
5428 KB |
Output is correct |
51 |
Correct |
11 ms |
5340 KB |
Output is correct |
52 |
Correct |
19 ms |
7472 KB |
Output is correct |
53 |
Correct |
13 ms |
6384 KB |
Output is correct |
54 |
Correct |
14 ms |
8316 KB |
Output is correct |
55 |
Correct |
14 ms |
8256 KB |
Output is correct |
56 |
Correct |
11 ms |
4492 KB |
Output is correct |
57 |
Correct |
6 ms |
4356 KB |
Output is correct |
58 |
Correct |
6 ms |
4920 KB |
Output is correct |
59 |
Correct |
10 ms |
6560 KB |
Output is correct |
60 |
Correct |
1 ms |
1880 KB |
Output is correct |
61 |
Correct |
2 ms |
2516 KB |
Output is correct |
62 |
Correct |
2 ms |
2904 KB |
Output is correct |
63 |
Correct |
3 ms |
2516 KB |
Output is correct |
64 |
Correct |
2 ms |
2584 KB |
Output is correct |
65 |
Correct |
3 ms |
2684 KB |
Output is correct |
66 |
Correct |
2 ms |
2516 KB |
Output is correct |
67 |
Correct |
3 ms |
3292 KB |
Output is correct |
68 |
Correct |
3 ms |
2688 KB |
Output is correct |
69 |
Correct |
3 ms |
3292 KB |
Output is correct |
70 |
Correct |
3 ms |
3548 KB |
Output is correct |
71 |
Correct |
3 ms |
2688 KB |
Output is correct |
72 |
Correct |
3 ms |
2688 KB |
Output is correct |