#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
int lans = 0;
int qry(int x){
int ans = Query(x);
swap(lans, ans);
return lans != ans;
}
void dnc(vector<int> &v1, vector<int> &v2, bool lin){
int sz = v1.size(), mid = sz >> 1;
if (sz == 1){
Answer(v1[0], v2[0]);
return;
}
vector<int> l1, l2, r1, r2;
for (int i = 0; i < mid; i++){
qry(v1[i]); l1.push_back(v1[i]);
}
for (int i = mid; i < sz; i++) r1.push_back(v1[i]);
for (int i = 0; i < sz; i++){
if (l2.size() == l1.size()) r2.push_back(v2[i]);
else if (r2.size() == r1.size()) l2.push_back(v2[i]);
else{
if (lin != qry(v2[i])) l2.push_back(v2[i]);
else r2.push_back(v2[i]);
}
}
dnc(l1, l2, !lin); dnc(r1, r2, lin);
}
void Solve(int N){
vector<int> v1, v2;
for (int i = 1; i <= 2 * N; i++){
if (qry(i)) v1.push_back(i);
else v2.push_back(i);
}
dnc(v1, v2, 0);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
600 KB |
Output is correct |
4 |
Correct |
5 ms |
936 KB |
Output is correct |
5 |
Correct |
9 ms |
1112 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
5 ms |
936 KB |
Output is correct |
9 |
Correct |
9 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1136 KB |
Output is correct |
12 |
Correct |
9 ms |
1112 KB |
Output is correct |
13 |
Correct |
7 ms |
1064 KB |
Output is correct |
14 |
Correct |
9 ms |
1312 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
5 ms |
936 KB |
Output is correct |
9 |
Correct |
9 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1136 KB |
Output is correct |
12 |
Correct |
9 ms |
1112 KB |
Output is correct |
13 |
Correct |
7 ms |
1064 KB |
Output is correct |
14 |
Correct |
9 ms |
1312 KB |
Output is correct |
15 |
Correct |
25 ms |
2780 KB |
Output is correct |
16 |
Correct |
25 ms |
2528 KB |
Output is correct |
17 |
Correct |
17 ms |
2488 KB |
Output is correct |
18 |
Correct |
18 ms |
2640 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
5 ms |
936 KB |
Output is correct |
9 |
Correct |
9 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1136 KB |
Output is correct |
12 |
Correct |
9 ms |
1112 KB |
Output is correct |
13 |
Correct |
7 ms |
1064 KB |
Output is correct |
14 |
Correct |
9 ms |
1312 KB |
Output is correct |
15 |
Correct |
25 ms |
2780 KB |
Output is correct |
16 |
Correct |
25 ms |
2528 KB |
Output is correct |
17 |
Correct |
17 ms |
2488 KB |
Output is correct |
18 |
Correct |
18 ms |
2640 KB |
Output is correct |
19 |
Correct |
26 ms |
2796 KB |
Output is correct |
20 |
Correct |
29 ms |
2904 KB |
Output is correct |
21 |
Correct |
21 ms |
2672 KB |
Output is correct |
22 |
Correct |
18 ms |
2644 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
5 ms |
936 KB |
Output is correct |
9 |
Correct |
9 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1136 KB |
Output is correct |
12 |
Correct |
9 ms |
1112 KB |
Output is correct |
13 |
Correct |
7 ms |
1064 KB |
Output is correct |
14 |
Correct |
9 ms |
1312 KB |
Output is correct |
15 |
Correct |
25 ms |
2780 KB |
Output is correct |
16 |
Correct |
25 ms |
2528 KB |
Output is correct |
17 |
Correct |
17 ms |
2488 KB |
Output is correct |
18 |
Correct |
18 ms |
2640 KB |
Output is correct |
19 |
Correct |
26 ms |
2796 KB |
Output is correct |
20 |
Correct |
29 ms |
2904 KB |
Output is correct |
21 |
Correct |
21 ms |
2672 KB |
Output is correct |
22 |
Correct |
18 ms |
2644 KB |
Output is correct |
23 |
Correct |
27 ms |
3056 KB |
Output is correct |
24 |
Correct |
27 ms |
2788 KB |
Output is correct |
25 |
Correct |
18 ms |
3024 KB |
Output is correct |
26 |
Correct |
19 ms |
2688 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
5 ms |
936 KB |
Output is correct |
9 |
Correct |
9 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1136 KB |
Output is correct |
12 |
Correct |
9 ms |
1112 KB |
Output is correct |
13 |
Correct |
7 ms |
1064 KB |
Output is correct |
14 |
Correct |
9 ms |
1312 KB |
Output is correct |
15 |
Correct |
25 ms |
2780 KB |
Output is correct |
16 |
Correct |
25 ms |
2528 KB |
Output is correct |
17 |
Correct |
17 ms |
2488 KB |
Output is correct |
18 |
Correct |
18 ms |
2640 KB |
Output is correct |
19 |
Correct |
26 ms |
2796 KB |
Output is correct |
20 |
Correct |
29 ms |
2904 KB |
Output is correct |
21 |
Correct |
21 ms |
2672 KB |
Output is correct |
22 |
Correct |
18 ms |
2644 KB |
Output is correct |
23 |
Correct |
27 ms |
3056 KB |
Output is correct |
24 |
Correct |
27 ms |
2788 KB |
Output is correct |
25 |
Correct |
18 ms |
3024 KB |
Output is correct |
26 |
Correct |
19 ms |
2688 KB |
Output is correct |
27 |
Correct |
26 ms |
2904 KB |
Output is correct |
28 |
Correct |
27 ms |
2896 KB |
Output is correct |
29 |
Correct |
19 ms |
2808 KB |
Output is correct |
30 |
Correct |
20 ms |
2640 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
5 ms |
936 KB |
Output is correct |
9 |
Correct |
9 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1136 KB |
Output is correct |
12 |
Correct |
9 ms |
1112 KB |
Output is correct |
13 |
Correct |
7 ms |
1064 KB |
Output is correct |
14 |
Correct |
9 ms |
1312 KB |
Output is correct |
15 |
Correct |
25 ms |
2780 KB |
Output is correct |
16 |
Correct |
25 ms |
2528 KB |
Output is correct |
17 |
Correct |
17 ms |
2488 KB |
Output is correct |
18 |
Correct |
18 ms |
2640 KB |
Output is correct |
19 |
Correct |
26 ms |
2796 KB |
Output is correct |
20 |
Correct |
29 ms |
2904 KB |
Output is correct |
21 |
Correct |
21 ms |
2672 KB |
Output is correct |
22 |
Correct |
18 ms |
2644 KB |
Output is correct |
23 |
Correct |
27 ms |
3056 KB |
Output is correct |
24 |
Correct |
27 ms |
2788 KB |
Output is correct |
25 |
Correct |
18 ms |
3024 KB |
Output is correct |
26 |
Correct |
19 ms |
2688 KB |
Output is correct |
27 |
Correct |
26 ms |
2904 KB |
Output is correct |
28 |
Correct |
27 ms |
2896 KB |
Output is correct |
29 |
Correct |
19 ms |
2808 KB |
Output is correct |
30 |
Correct |
20 ms |
2640 KB |
Output is correct |
31 |
Correct |
27 ms |
2920 KB |
Output is correct |
32 |
Correct |
30 ms |
2816 KB |
Output is correct |
33 |
Correct |
22 ms |
3240 KB |
Output is correct |
34 |
Correct |
20 ms |
3152 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
600 KB |
Output is correct |
8 |
Correct |
5 ms |
936 KB |
Output is correct |
9 |
Correct |
9 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
1136 KB |
Output is correct |
12 |
Correct |
9 ms |
1112 KB |
Output is correct |
13 |
Correct |
7 ms |
1064 KB |
Output is correct |
14 |
Correct |
9 ms |
1312 KB |
Output is correct |
15 |
Correct |
25 ms |
2780 KB |
Output is correct |
16 |
Correct |
25 ms |
2528 KB |
Output is correct |
17 |
Correct |
17 ms |
2488 KB |
Output is correct |
18 |
Correct |
18 ms |
2640 KB |
Output is correct |
19 |
Correct |
26 ms |
2796 KB |
Output is correct |
20 |
Correct |
29 ms |
2904 KB |
Output is correct |
21 |
Correct |
21 ms |
2672 KB |
Output is correct |
22 |
Correct |
18 ms |
2644 KB |
Output is correct |
23 |
Correct |
27 ms |
3056 KB |
Output is correct |
24 |
Correct |
27 ms |
2788 KB |
Output is correct |
25 |
Correct |
18 ms |
3024 KB |
Output is correct |
26 |
Correct |
19 ms |
2688 KB |
Output is correct |
27 |
Correct |
26 ms |
2904 KB |
Output is correct |
28 |
Correct |
27 ms |
2896 KB |
Output is correct |
29 |
Correct |
19 ms |
2808 KB |
Output is correct |
30 |
Correct |
20 ms |
2640 KB |
Output is correct |
31 |
Correct |
27 ms |
2920 KB |
Output is correct |
32 |
Correct |
30 ms |
2816 KB |
Output is correct |
33 |
Correct |
22 ms |
3240 KB |
Output is correct |
34 |
Correct |
20 ms |
3152 KB |
Output is correct |
35 |
Incorrect |
28 ms |
2816 KB |
Wrong Answer [2] |
36 |
Halted |
0 ms |
0 KB |
- |