# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
554967 | 2022-04-29T18:36:23 Z | MilosMilutinovic | Minerals (JOI19_minerals) | C++14 | 53 ms | 3872 KB |
#include "minerals.h" #include <bits/stdc++.h> using namespace std; void solve(vector<int> l, vector<int> r, bool active) { if (l.size() == 1) { Answer(l[0], r[0]); return; } int sz = l.size(); int mid = max(1, (sz * 40) / 100); vector<vector<int>> go_l(2); vector<vector<int>> go_r(2); for (int i = 0; i < mid; i++) { go_l[0].push_back(l[i]); } for (int i = mid; i < sz; i++) { go_l[1].push_back(l[i]); } int cc = 0; for (int i = 0; i < mid; i++) { cc = Query(l[i]); } for (int i = 0; i < r.size(); i++) { if (go_l[0].size() == go_r[0].size()) { go_r[1].push_back(r[i]); } else if (go_l[1].size() == go_r[1].size()) { go_r[0].push_back(r[i]); } else { int qq = Query(r[i]); if (cc == qq) { if (active) { go_r[1].push_back(r[i]); } else { go_r[0].push_back(r[i]); } } else { if (active) { go_r[0].push_back(r[i]); } else { go_r[1].push_back(r[i]); } } cc = qq; } } solve(go_l[0], go_r[0], !active); solve(go_l[1], go_r[1], active); } void Solve(int n) { vector<int> l; vector<int> r; int y = 0; for (int i = 1; i <= 2 * n; i++) { int x = Query(i); if (x != y) { l.push_back(i); } else { r.push_back(i); } y = x; } solve(l, r, 1); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 2 ms | 464 KB | Output is correct |
3 | Correct | 4 ms | 592 KB | Output is correct |
4 | Correct | 8 ms | 976 KB | Output is correct |
5 | Correct | 16 ms | 1488 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 2 ms | 464 KB | Output is correct |
7 | Correct | 4 ms | 592 KB | Output is correct |
8 | Correct | 8 ms | 976 KB | Output is correct |
9 | Correct | 16 ms | 1488 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 14 ms | 1152 KB | Output is correct |
12 | Correct | 17 ms | 1608 KB | Output is correct |
13 | Correct | 14 ms | 1488 KB | Output is correct |
14 | Correct | 17 ms | 1488 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 2 ms | 464 KB | Output is correct |
7 | Correct | 4 ms | 592 KB | Output is correct |
8 | Correct | 8 ms | 976 KB | Output is correct |
9 | Correct | 16 ms | 1488 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 14 ms | 1152 KB | Output is correct |
12 | Correct | 17 ms | 1608 KB | Output is correct |
13 | Correct | 14 ms | 1488 KB | Output is correct |
14 | Correct | 17 ms | 1488 KB | Output is correct |
15 | Correct | 45 ms | 3432 KB | Output is correct |
16 | Correct | 44 ms | 3504 KB | Output is correct |
17 | Correct | 38 ms | 3392 KB | Output is correct |
18 | Correct | 37 ms | 3332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 2 ms | 464 KB | Output is correct |
7 | Correct | 4 ms | 592 KB | Output is correct |
8 | Correct | 8 ms | 976 KB | Output is correct |
9 | Correct | 16 ms | 1488 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 14 ms | 1152 KB | Output is correct |
12 | Correct | 17 ms | 1608 KB | Output is correct |
13 | Correct | 14 ms | 1488 KB | Output is correct |
14 | Correct | 17 ms | 1488 KB | Output is correct |
15 | Correct | 45 ms | 3432 KB | Output is correct |
16 | Correct | 44 ms | 3504 KB | Output is correct |
17 | Correct | 38 ms | 3392 KB | Output is correct |
18 | Correct | 37 ms | 3332 KB | Output is correct |
19 | Correct | 45 ms | 3540 KB | Output is correct |
20 | Correct | 46 ms | 3480 KB | Output is correct |
21 | Correct | 34 ms | 3572 KB | Output is correct |
22 | Correct | 38 ms | 3356 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 2 ms | 464 KB | Output is correct |
7 | Correct | 4 ms | 592 KB | Output is correct |
8 | Correct | 8 ms | 976 KB | Output is correct |
9 | Correct | 16 ms | 1488 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 14 ms | 1152 KB | Output is correct |
12 | Correct | 17 ms | 1608 KB | Output is correct |
13 | Correct | 14 ms | 1488 KB | Output is correct |
14 | Correct | 17 ms | 1488 KB | Output is correct |
15 | Correct | 45 ms | 3432 KB | Output is correct |
16 | Correct | 44 ms | 3504 KB | Output is correct |
17 | Correct | 38 ms | 3392 KB | Output is correct |
18 | Correct | 37 ms | 3332 KB | Output is correct |
19 | Correct | 45 ms | 3540 KB | Output is correct |
20 | Correct | 46 ms | 3480 KB | Output is correct |
21 | Correct | 34 ms | 3572 KB | Output is correct |
22 | Correct | 38 ms | 3356 KB | Output is correct |
23 | Correct | 45 ms | 3592 KB | Output is correct |
24 | Correct | 45 ms | 3564 KB | Output is correct |
25 | Correct | 37 ms | 3680 KB | Output is correct |
26 | Correct | 41 ms | 3460 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 2 ms | 464 KB | Output is correct |
7 | Correct | 4 ms | 592 KB | Output is correct |
8 | Correct | 8 ms | 976 KB | Output is correct |
9 | Correct | 16 ms | 1488 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 14 ms | 1152 KB | Output is correct |
12 | Correct | 17 ms | 1608 KB | Output is correct |
13 | Correct | 14 ms | 1488 KB | Output is correct |
14 | Correct | 17 ms | 1488 KB | Output is correct |
15 | Correct | 45 ms | 3432 KB | Output is correct |
16 | Correct | 44 ms | 3504 KB | Output is correct |
17 | Correct | 38 ms | 3392 KB | Output is correct |
18 | Correct | 37 ms | 3332 KB | Output is correct |
19 | Correct | 45 ms | 3540 KB | Output is correct |
20 | Correct | 46 ms | 3480 KB | Output is correct |
21 | Correct | 34 ms | 3572 KB | Output is correct |
22 | Correct | 38 ms | 3356 KB | Output is correct |
23 | Correct | 45 ms | 3592 KB | Output is correct |
24 | Correct | 45 ms | 3564 KB | Output is correct |
25 | Correct | 37 ms | 3680 KB | Output is correct |
26 | Correct | 41 ms | 3460 KB | Output is correct |
27 | Correct | 48 ms | 3672 KB | Output is correct |
28 | Correct | 47 ms | 3648 KB | Output is correct |
29 | Correct | 36 ms | 3616 KB | Output is correct |
30 | Correct | 38 ms | 3592 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 2 ms | 464 KB | Output is correct |
7 | Correct | 4 ms | 592 KB | Output is correct |
8 | Correct | 8 ms | 976 KB | Output is correct |
9 | Correct | 16 ms | 1488 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 14 ms | 1152 KB | Output is correct |
12 | Correct | 17 ms | 1608 KB | Output is correct |
13 | Correct | 14 ms | 1488 KB | Output is correct |
14 | Correct | 17 ms | 1488 KB | Output is correct |
15 | Correct | 45 ms | 3432 KB | Output is correct |
16 | Correct | 44 ms | 3504 KB | Output is correct |
17 | Correct | 38 ms | 3392 KB | Output is correct |
18 | Correct | 37 ms | 3332 KB | Output is correct |
19 | Correct | 45 ms | 3540 KB | Output is correct |
20 | Correct | 46 ms | 3480 KB | Output is correct |
21 | Correct | 34 ms | 3572 KB | Output is correct |
22 | Correct | 38 ms | 3356 KB | Output is correct |
23 | Correct | 45 ms | 3592 KB | Output is correct |
24 | Correct | 45 ms | 3564 KB | Output is correct |
25 | Correct | 37 ms | 3680 KB | Output is correct |
26 | Correct | 41 ms | 3460 KB | Output is correct |
27 | Correct | 48 ms | 3672 KB | Output is correct |
28 | Correct | 47 ms | 3648 KB | Output is correct |
29 | Correct | 36 ms | 3616 KB | Output is correct |
30 | Correct | 38 ms | 3592 KB | Output is correct |
31 | Correct | 48 ms | 3724 KB | Output is correct |
32 | Correct | 52 ms | 3696 KB | Output is correct |
33 | Correct | 36 ms | 3752 KB | Output is correct |
34 | Correct | 53 ms | 3544 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 0 ms | 208 KB | Output is correct |
3 | Correct | 0 ms | 208 KB | Output is correct |
4 | Correct | 0 ms | 208 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 2 ms | 464 KB | Output is correct |
7 | Correct | 4 ms | 592 KB | Output is correct |
8 | Correct | 8 ms | 976 KB | Output is correct |
9 | Correct | 16 ms | 1488 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 14 ms | 1152 KB | Output is correct |
12 | Correct | 17 ms | 1608 KB | Output is correct |
13 | Correct | 14 ms | 1488 KB | Output is correct |
14 | Correct | 17 ms | 1488 KB | Output is correct |
15 | Correct | 45 ms | 3432 KB | Output is correct |
16 | Correct | 44 ms | 3504 KB | Output is correct |
17 | Correct | 38 ms | 3392 KB | Output is correct |
18 | Correct | 37 ms | 3332 KB | Output is correct |
19 | Correct | 45 ms | 3540 KB | Output is correct |
20 | Correct | 46 ms | 3480 KB | Output is correct |
21 | Correct | 34 ms | 3572 KB | Output is correct |
22 | Correct | 38 ms | 3356 KB | Output is correct |
23 | Correct | 45 ms | 3592 KB | Output is correct |
24 | Correct | 45 ms | 3564 KB | Output is correct |
25 | Correct | 37 ms | 3680 KB | Output is correct |
26 | Correct | 41 ms | 3460 KB | Output is correct |
27 | Correct | 48 ms | 3672 KB | Output is correct |
28 | Correct | 47 ms | 3648 KB | Output is correct |
29 | Correct | 36 ms | 3616 KB | Output is correct |
30 | Correct | 38 ms | 3592 KB | Output is correct |
31 | Correct | 48 ms | 3724 KB | Output is correct |
32 | Correct | 52 ms | 3696 KB | Output is correct |
33 | Correct | 36 ms | 3752 KB | Output is correct |
34 | Correct | 53 ms | 3544 KB | Output is correct |
35 | Correct | 49 ms | 3796 KB | Output is correct |
36 | Correct | 47 ms | 3872 KB | Output is correct |
37 | Correct | 38 ms | 3744 KB | Output is correct |
38 | Correct | 40 ms | 3680 KB | Output is correct |