#include "minerals.h"
#include <vector>
using namespace std;
int baseline = 0;
bool cpair(int i) {
int tmp = Query(i);
bool tmp2 = tmp == baseline;
baseline = tmp;
return tmp2;
}
vector<int> fst;
vector<int> snd;
void search(bool filled, int l, int h, vector<int> v) {
if (h-l == 1) {
Answer(fst[l], v[0]);
return;
}
int m = (l+h)/2;
vector<int> lv;
vector<int> hv;
for (int i = l; i < m; i++) cpair(fst[i]);
for (int i = 0; i < h-l; i++) {
if (cpair(v[i]) != filled) {
lv.push_back(v[i]);
} else {
hv.push_back(v[i]);
}
}
search(!filled, l, m, lv);
search(filled, m, h, hv);
}
void Solve(int N) {
int prev = 0;
for (int i = 1; i <= N*2; i++) {
if (cpair(i)) fst.push_back(i);
}
for (int i = 1, j = 0; i <= N*2; i++) {
if (j<N && i == fst[j]) {
j++;
continue;
}
snd.push_back(i);
}
search(true, 0, N, snd);
}
Compilation message
minerals.cpp: In function 'void Solve(int)':
minerals.cpp:38:7: warning: unused variable 'prev' [-Wunused-variable]
38 | int prev = 0;
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
404 KB |
Output is correct |
3 |
Correct |
2 ms |
464 KB |
Output is correct |
4 |
Correct |
5 ms |
592 KB |
Output is correct |
5 |
Correct |
10 ms |
1052 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
404 KB |
Output is correct |
7 |
Correct |
2 ms |
464 KB |
Output is correct |
8 |
Correct |
5 ms |
592 KB |
Output is correct |
9 |
Correct |
10 ms |
1052 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
5 ms |
876 KB |
Output is correct |
12 |
Correct |
8 ms |
1104 KB |
Output is correct |
13 |
Correct |
6 ms |
1104 KB |
Output is correct |
14 |
Correct |
6 ms |
976 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
404 KB |
Output is correct |
7 |
Correct |
2 ms |
464 KB |
Output is correct |
8 |
Correct |
5 ms |
592 KB |
Output is correct |
9 |
Correct |
10 ms |
1052 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
5 ms |
876 KB |
Output is correct |
12 |
Correct |
8 ms |
1104 KB |
Output is correct |
13 |
Correct |
6 ms |
1104 KB |
Output is correct |
14 |
Correct |
6 ms |
976 KB |
Output is correct |
15 |
Correct |
26 ms |
2384 KB |
Output is correct |
16 |
Correct |
22 ms |
2356 KB |
Output is correct |
17 |
Correct |
15 ms |
2416 KB |
Output is correct |
18 |
Correct |
16 ms |
2256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
404 KB |
Output is correct |
7 |
Correct |
2 ms |
464 KB |
Output is correct |
8 |
Correct |
5 ms |
592 KB |
Output is correct |
9 |
Correct |
10 ms |
1052 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
5 ms |
876 KB |
Output is correct |
12 |
Correct |
8 ms |
1104 KB |
Output is correct |
13 |
Correct |
6 ms |
1104 KB |
Output is correct |
14 |
Correct |
6 ms |
976 KB |
Output is correct |
15 |
Correct |
26 ms |
2384 KB |
Output is correct |
16 |
Correct |
22 ms |
2356 KB |
Output is correct |
17 |
Correct |
15 ms |
2416 KB |
Output is correct |
18 |
Correct |
16 ms |
2256 KB |
Output is correct |
19 |
Correct |
22 ms |
2504 KB |
Output is correct |
20 |
Correct |
26 ms |
2552 KB |
Output is correct |
21 |
Correct |
16 ms |
2372 KB |
Output is correct |
22 |
Correct |
16 ms |
2340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
404 KB |
Output is correct |
7 |
Correct |
2 ms |
464 KB |
Output is correct |
8 |
Correct |
5 ms |
592 KB |
Output is correct |
9 |
Correct |
10 ms |
1052 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
5 ms |
876 KB |
Output is correct |
12 |
Correct |
8 ms |
1104 KB |
Output is correct |
13 |
Correct |
6 ms |
1104 KB |
Output is correct |
14 |
Correct |
6 ms |
976 KB |
Output is correct |
15 |
Correct |
26 ms |
2384 KB |
Output is correct |
16 |
Correct |
22 ms |
2356 KB |
Output is correct |
17 |
Correct |
15 ms |
2416 KB |
Output is correct |
18 |
Correct |
16 ms |
2256 KB |
Output is correct |
19 |
Correct |
22 ms |
2504 KB |
Output is correct |
20 |
Correct |
26 ms |
2552 KB |
Output is correct |
21 |
Correct |
16 ms |
2372 KB |
Output is correct |
22 |
Correct |
16 ms |
2340 KB |
Output is correct |
23 |
Correct |
23 ms |
2552 KB |
Output is correct |
24 |
Correct |
22 ms |
2520 KB |
Output is correct |
25 |
Correct |
16 ms |
2464 KB |
Output is correct |
26 |
Correct |
19 ms |
2356 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
404 KB |
Output is correct |
7 |
Correct |
2 ms |
464 KB |
Output is correct |
8 |
Correct |
5 ms |
592 KB |
Output is correct |
9 |
Correct |
10 ms |
1052 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
5 ms |
876 KB |
Output is correct |
12 |
Correct |
8 ms |
1104 KB |
Output is correct |
13 |
Correct |
6 ms |
1104 KB |
Output is correct |
14 |
Correct |
6 ms |
976 KB |
Output is correct |
15 |
Correct |
26 ms |
2384 KB |
Output is correct |
16 |
Correct |
22 ms |
2356 KB |
Output is correct |
17 |
Correct |
15 ms |
2416 KB |
Output is correct |
18 |
Correct |
16 ms |
2256 KB |
Output is correct |
19 |
Correct |
22 ms |
2504 KB |
Output is correct |
20 |
Correct |
26 ms |
2552 KB |
Output is correct |
21 |
Correct |
16 ms |
2372 KB |
Output is correct |
22 |
Correct |
16 ms |
2340 KB |
Output is correct |
23 |
Correct |
23 ms |
2552 KB |
Output is correct |
24 |
Correct |
22 ms |
2520 KB |
Output is correct |
25 |
Correct |
16 ms |
2464 KB |
Output is correct |
26 |
Correct |
19 ms |
2356 KB |
Output is correct |
27 |
Incorrect |
24 ms |
2564 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
404 KB |
Output is correct |
7 |
Correct |
2 ms |
464 KB |
Output is correct |
8 |
Correct |
5 ms |
592 KB |
Output is correct |
9 |
Correct |
10 ms |
1052 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
5 ms |
876 KB |
Output is correct |
12 |
Correct |
8 ms |
1104 KB |
Output is correct |
13 |
Correct |
6 ms |
1104 KB |
Output is correct |
14 |
Correct |
6 ms |
976 KB |
Output is correct |
15 |
Correct |
26 ms |
2384 KB |
Output is correct |
16 |
Correct |
22 ms |
2356 KB |
Output is correct |
17 |
Correct |
15 ms |
2416 KB |
Output is correct |
18 |
Correct |
16 ms |
2256 KB |
Output is correct |
19 |
Correct |
22 ms |
2504 KB |
Output is correct |
20 |
Correct |
26 ms |
2552 KB |
Output is correct |
21 |
Correct |
16 ms |
2372 KB |
Output is correct |
22 |
Correct |
16 ms |
2340 KB |
Output is correct |
23 |
Correct |
23 ms |
2552 KB |
Output is correct |
24 |
Correct |
22 ms |
2520 KB |
Output is correct |
25 |
Correct |
16 ms |
2464 KB |
Output is correct |
26 |
Correct |
19 ms |
2356 KB |
Output is correct |
27 |
Incorrect |
24 ms |
2564 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
404 KB |
Output is correct |
7 |
Correct |
2 ms |
464 KB |
Output is correct |
8 |
Correct |
5 ms |
592 KB |
Output is correct |
9 |
Correct |
10 ms |
1052 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
5 ms |
876 KB |
Output is correct |
12 |
Correct |
8 ms |
1104 KB |
Output is correct |
13 |
Correct |
6 ms |
1104 KB |
Output is correct |
14 |
Correct |
6 ms |
976 KB |
Output is correct |
15 |
Correct |
26 ms |
2384 KB |
Output is correct |
16 |
Correct |
22 ms |
2356 KB |
Output is correct |
17 |
Correct |
15 ms |
2416 KB |
Output is correct |
18 |
Correct |
16 ms |
2256 KB |
Output is correct |
19 |
Correct |
22 ms |
2504 KB |
Output is correct |
20 |
Correct |
26 ms |
2552 KB |
Output is correct |
21 |
Correct |
16 ms |
2372 KB |
Output is correct |
22 |
Correct |
16 ms |
2340 KB |
Output is correct |
23 |
Correct |
23 ms |
2552 KB |
Output is correct |
24 |
Correct |
22 ms |
2520 KB |
Output is correct |
25 |
Correct |
16 ms |
2464 KB |
Output is correct |
26 |
Correct |
19 ms |
2356 KB |
Output is correct |
27 |
Incorrect |
24 ms |
2564 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |