#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
bool query(int x) {
static int lst = 0;
int cur = Query(x);
int ans = lst ^ cur;
lst = cur;
return ans;
}
void solve(vector<int> a, vector<int> b, bool in) {
int n = a.size(), m = ceil(n * .38);
if (n == 0) return;
if (n == 1) { Answer(a[0], b[0]); return; }
if (in) for (int i = n - 1; i >= m; --i) query(a[i]);
else for (int i = 0; i < m; ++i) query(a[i]);
random_shuffle(begin(b), end(b));
vector<int> bl, br;
for (const int& i: b) {
bool go_l = (bl.size() < m and (br.size() == n - m or !query(i)));
(go_l ? bl : br).emplace_back(i);
}
solve(vector<int>(begin(a), begin(a) + m), bl, true);
solve(vector<int>(begin(a) + m, end(a)), br, false);
}
}
void Solve(int N) {
vector<int> a, b;
for (int i = 1; i <= N * 2; ++i)
(query(i) ? b : a).emplace_back(i);
solve(a, b, true);
}
Compilation message
minerals.cpp: In function 'void {anonymous}::solve(std::vector<int>, std::vector<int>, bool)':
minerals.cpp:24:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
24 | bool go_l = (bl.size() < m and (br.size() == n - m or !query(i)));
| ~~~~~~~~~~^~~
minerals.cpp:24:45: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
24 | bool go_l = (bl.size() < m and (br.size() == n - m or !query(i)));
| ~~~~~~~~~~^~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
328 KB |
Output is correct |
2 |
Correct |
2 ms |
328 KB |
Output is correct |
3 |
Correct |
4 ms |
584 KB |
Output is correct |
4 |
Correct |
8 ms |
840 KB |
Output is correct |
5 |
Correct |
16 ms |
1352 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
584 KB |
Output is correct |
8 |
Correct |
8 ms |
840 KB |
Output is correct |
9 |
Correct |
16 ms |
1352 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
10 ms |
968 KB |
Output is correct |
12 |
Correct |
17 ms |
1396 KB |
Output is correct |
13 |
Correct |
15 ms |
1352 KB |
Output is correct |
14 |
Correct |
15 ms |
1284 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
584 KB |
Output is correct |
8 |
Correct |
8 ms |
840 KB |
Output is correct |
9 |
Correct |
16 ms |
1352 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
10 ms |
968 KB |
Output is correct |
12 |
Correct |
17 ms |
1396 KB |
Output is correct |
13 |
Correct |
15 ms |
1352 KB |
Output is correct |
14 |
Correct |
15 ms |
1284 KB |
Output is correct |
15 |
Correct |
44 ms |
2956 KB |
Output is correct |
16 |
Correct |
48 ms |
2964 KB |
Output is correct |
17 |
Correct |
44 ms |
2956 KB |
Output is correct |
18 |
Correct |
45 ms |
2856 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
584 KB |
Output is correct |
8 |
Correct |
8 ms |
840 KB |
Output is correct |
9 |
Correct |
16 ms |
1352 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
10 ms |
968 KB |
Output is correct |
12 |
Correct |
17 ms |
1396 KB |
Output is correct |
13 |
Correct |
15 ms |
1352 KB |
Output is correct |
14 |
Correct |
15 ms |
1284 KB |
Output is correct |
15 |
Correct |
44 ms |
2956 KB |
Output is correct |
16 |
Correct |
48 ms |
2964 KB |
Output is correct |
17 |
Correct |
44 ms |
2956 KB |
Output is correct |
18 |
Correct |
45 ms |
2856 KB |
Output is correct |
19 |
Correct |
48 ms |
3024 KB |
Output is correct |
20 |
Correct |
46 ms |
3116 KB |
Output is correct |
21 |
Correct |
40 ms |
3056 KB |
Output is correct |
22 |
Correct |
42 ms |
3052 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
584 KB |
Output is correct |
8 |
Correct |
8 ms |
840 KB |
Output is correct |
9 |
Correct |
16 ms |
1352 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
10 ms |
968 KB |
Output is correct |
12 |
Correct |
17 ms |
1396 KB |
Output is correct |
13 |
Correct |
15 ms |
1352 KB |
Output is correct |
14 |
Correct |
15 ms |
1284 KB |
Output is correct |
15 |
Correct |
44 ms |
2956 KB |
Output is correct |
16 |
Correct |
48 ms |
2964 KB |
Output is correct |
17 |
Correct |
44 ms |
2956 KB |
Output is correct |
18 |
Correct |
45 ms |
2856 KB |
Output is correct |
19 |
Correct |
48 ms |
3024 KB |
Output is correct |
20 |
Correct |
46 ms |
3116 KB |
Output is correct |
21 |
Correct |
40 ms |
3056 KB |
Output is correct |
22 |
Correct |
42 ms |
3052 KB |
Output is correct |
23 |
Correct |
46 ms |
3096 KB |
Output is correct |
24 |
Correct |
53 ms |
3160 KB |
Output is correct |
25 |
Correct |
43 ms |
3156 KB |
Output is correct |
26 |
Correct |
43 ms |
2960 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
584 KB |
Output is correct |
8 |
Correct |
8 ms |
840 KB |
Output is correct |
9 |
Correct |
16 ms |
1352 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
10 ms |
968 KB |
Output is correct |
12 |
Correct |
17 ms |
1396 KB |
Output is correct |
13 |
Correct |
15 ms |
1352 KB |
Output is correct |
14 |
Correct |
15 ms |
1284 KB |
Output is correct |
15 |
Correct |
44 ms |
2956 KB |
Output is correct |
16 |
Correct |
48 ms |
2964 KB |
Output is correct |
17 |
Correct |
44 ms |
2956 KB |
Output is correct |
18 |
Correct |
45 ms |
2856 KB |
Output is correct |
19 |
Correct |
48 ms |
3024 KB |
Output is correct |
20 |
Correct |
46 ms |
3116 KB |
Output is correct |
21 |
Correct |
40 ms |
3056 KB |
Output is correct |
22 |
Correct |
42 ms |
3052 KB |
Output is correct |
23 |
Correct |
46 ms |
3096 KB |
Output is correct |
24 |
Correct |
53 ms |
3160 KB |
Output is correct |
25 |
Correct |
43 ms |
3156 KB |
Output is correct |
26 |
Correct |
43 ms |
2960 KB |
Output is correct |
27 |
Correct |
49 ms |
3324 KB |
Output is correct |
28 |
Correct |
53 ms |
3156 KB |
Output is correct |
29 |
Correct |
42 ms |
3256 KB |
Output is correct |
30 |
Correct |
45 ms |
3004 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
584 KB |
Output is correct |
8 |
Correct |
8 ms |
840 KB |
Output is correct |
9 |
Correct |
16 ms |
1352 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
10 ms |
968 KB |
Output is correct |
12 |
Correct |
17 ms |
1396 KB |
Output is correct |
13 |
Correct |
15 ms |
1352 KB |
Output is correct |
14 |
Correct |
15 ms |
1284 KB |
Output is correct |
15 |
Correct |
44 ms |
2956 KB |
Output is correct |
16 |
Correct |
48 ms |
2964 KB |
Output is correct |
17 |
Correct |
44 ms |
2956 KB |
Output is correct |
18 |
Correct |
45 ms |
2856 KB |
Output is correct |
19 |
Correct |
48 ms |
3024 KB |
Output is correct |
20 |
Correct |
46 ms |
3116 KB |
Output is correct |
21 |
Correct |
40 ms |
3056 KB |
Output is correct |
22 |
Correct |
42 ms |
3052 KB |
Output is correct |
23 |
Correct |
46 ms |
3096 KB |
Output is correct |
24 |
Correct |
53 ms |
3160 KB |
Output is correct |
25 |
Correct |
43 ms |
3156 KB |
Output is correct |
26 |
Correct |
43 ms |
2960 KB |
Output is correct |
27 |
Correct |
49 ms |
3324 KB |
Output is correct |
28 |
Correct |
53 ms |
3156 KB |
Output is correct |
29 |
Correct |
42 ms |
3256 KB |
Output is correct |
30 |
Correct |
45 ms |
3004 KB |
Output is correct |
31 |
Incorrect |
47 ms |
3268 KB |
Wrong Answer [2] |
32 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
0 ms |
200 KB |
Output is correct |
3 |
Correct |
0 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
2 ms |
328 KB |
Output is correct |
7 |
Correct |
4 ms |
584 KB |
Output is correct |
8 |
Correct |
8 ms |
840 KB |
Output is correct |
9 |
Correct |
16 ms |
1352 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
10 ms |
968 KB |
Output is correct |
12 |
Correct |
17 ms |
1396 KB |
Output is correct |
13 |
Correct |
15 ms |
1352 KB |
Output is correct |
14 |
Correct |
15 ms |
1284 KB |
Output is correct |
15 |
Correct |
44 ms |
2956 KB |
Output is correct |
16 |
Correct |
48 ms |
2964 KB |
Output is correct |
17 |
Correct |
44 ms |
2956 KB |
Output is correct |
18 |
Correct |
45 ms |
2856 KB |
Output is correct |
19 |
Correct |
48 ms |
3024 KB |
Output is correct |
20 |
Correct |
46 ms |
3116 KB |
Output is correct |
21 |
Correct |
40 ms |
3056 KB |
Output is correct |
22 |
Correct |
42 ms |
3052 KB |
Output is correct |
23 |
Correct |
46 ms |
3096 KB |
Output is correct |
24 |
Correct |
53 ms |
3160 KB |
Output is correct |
25 |
Correct |
43 ms |
3156 KB |
Output is correct |
26 |
Correct |
43 ms |
2960 KB |
Output is correct |
27 |
Correct |
49 ms |
3324 KB |
Output is correct |
28 |
Correct |
53 ms |
3156 KB |
Output is correct |
29 |
Correct |
42 ms |
3256 KB |
Output is correct |
30 |
Correct |
45 ms |
3004 KB |
Output is correct |
31 |
Incorrect |
47 ms |
3268 KB |
Wrong Answer [2] |
32 |
Halted |
0 ms |
0 KB |
- |