#include<bits/stdc++.h>
#include "minerals.h"
using namespace std;
typedef vector <int> vi;
int n, prosli = 0;
bool pitaj (int x) {
int novi = Query(x);
bool res = (prosli != novi);
prosli = novi;
return res;
}
void calc (vi a, vi b, bool ta, bool tb) {
int siz = a.size();
if (siz == 1) {
Answer(a[0], b[0]);
return;
}
int pola = siz / 2;
vi a1, b1, a2, b2;
if (ta == 0) {
for (int i = 0; i < siz; i++) {
if (i < pola) {
pitaj(a[i]);
a1.push_back(a[i]);
} else {
a2.push_back(a[i]);
}
}
} else {
for (int i = 0; i < siz; i++) {
if (i < pola) {
pitaj(a[siz-1 - i]);
a2.push_back(a[siz-1 - i]);
} else {
a1.push_back(a[siz-1 - i]);
}
}
}
for (int i = 0; i < siz; i++) {
if (pitaj(b[i])) b2.push_back(b[i]); else b1.push_back(b[i]);
}
calc(a1, b1, 1, !tb);
calc(a2, b2, 0, !tb);
}
void init () {
vi a, b;
for (int i = 1; i <= 2 * n; i++) {
if (pitaj(i)) a.push_back(i); else b.push_back(i);
}
calc(a, b, 1, 1);
}
void Solve (int N) {
n = N;
init();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
512 KB |
Output is correct |
3 |
Correct |
7 ms |
640 KB |
Output is correct |
4 |
Correct |
12 ms |
896 KB |
Output is correct |
5 |
Correct |
18 ms |
1356 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
512 KB |
Output is correct |
7 |
Correct |
7 ms |
640 KB |
Output is correct |
8 |
Correct |
12 ms |
896 KB |
Output is correct |
9 |
Correct |
18 ms |
1356 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
14 ms |
1152 KB |
Output is correct |
12 |
Correct |
20 ms |
1452 KB |
Output is correct |
13 |
Correct |
17 ms |
1460 KB |
Output is correct |
14 |
Correct |
18 ms |
1324 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
512 KB |
Output is correct |
7 |
Correct |
7 ms |
640 KB |
Output is correct |
8 |
Correct |
12 ms |
896 KB |
Output is correct |
9 |
Correct |
18 ms |
1356 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
14 ms |
1152 KB |
Output is correct |
12 |
Correct |
20 ms |
1452 KB |
Output is correct |
13 |
Correct |
17 ms |
1460 KB |
Output is correct |
14 |
Correct |
18 ms |
1324 KB |
Output is correct |
15 |
Correct |
58 ms |
3224 KB |
Output is correct |
16 |
Correct |
60 ms |
3220 KB |
Output is correct |
17 |
Correct |
51 ms |
3132 KB |
Output is correct |
18 |
Correct |
51 ms |
3012 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
512 KB |
Output is correct |
7 |
Correct |
7 ms |
640 KB |
Output is correct |
8 |
Correct |
12 ms |
896 KB |
Output is correct |
9 |
Correct |
18 ms |
1356 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
14 ms |
1152 KB |
Output is correct |
12 |
Correct |
20 ms |
1452 KB |
Output is correct |
13 |
Correct |
17 ms |
1460 KB |
Output is correct |
14 |
Correct |
18 ms |
1324 KB |
Output is correct |
15 |
Correct |
58 ms |
3224 KB |
Output is correct |
16 |
Correct |
60 ms |
3220 KB |
Output is correct |
17 |
Correct |
51 ms |
3132 KB |
Output is correct |
18 |
Correct |
51 ms |
3012 KB |
Output is correct |
19 |
Correct |
76 ms |
3308 KB |
Output is correct |
20 |
Correct |
65 ms |
3308 KB |
Output is correct |
21 |
Correct |
55 ms |
3120 KB |
Output is correct |
22 |
Correct |
55 ms |
2980 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
512 KB |
Output is correct |
7 |
Correct |
7 ms |
640 KB |
Output is correct |
8 |
Correct |
12 ms |
896 KB |
Output is correct |
9 |
Correct |
18 ms |
1356 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
14 ms |
1152 KB |
Output is correct |
12 |
Correct |
20 ms |
1452 KB |
Output is correct |
13 |
Correct |
17 ms |
1460 KB |
Output is correct |
14 |
Correct |
18 ms |
1324 KB |
Output is correct |
15 |
Correct |
58 ms |
3224 KB |
Output is correct |
16 |
Correct |
60 ms |
3220 KB |
Output is correct |
17 |
Correct |
51 ms |
3132 KB |
Output is correct |
18 |
Correct |
51 ms |
3012 KB |
Output is correct |
19 |
Correct |
76 ms |
3308 KB |
Output is correct |
20 |
Correct |
65 ms |
3308 KB |
Output is correct |
21 |
Correct |
55 ms |
3120 KB |
Output is correct |
22 |
Correct |
55 ms |
2980 KB |
Output is correct |
23 |
Correct |
73 ms |
3380 KB |
Output is correct |
24 |
Correct |
62 ms |
3468 KB |
Output is correct |
25 |
Correct |
58 ms |
3308 KB |
Output is correct |
26 |
Correct |
51 ms |
3056 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
512 KB |
Output is correct |
7 |
Correct |
7 ms |
640 KB |
Output is correct |
8 |
Correct |
12 ms |
896 KB |
Output is correct |
9 |
Correct |
18 ms |
1356 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
14 ms |
1152 KB |
Output is correct |
12 |
Correct |
20 ms |
1452 KB |
Output is correct |
13 |
Correct |
17 ms |
1460 KB |
Output is correct |
14 |
Correct |
18 ms |
1324 KB |
Output is correct |
15 |
Correct |
58 ms |
3224 KB |
Output is correct |
16 |
Correct |
60 ms |
3220 KB |
Output is correct |
17 |
Correct |
51 ms |
3132 KB |
Output is correct |
18 |
Correct |
51 ms |
3012 KB |
Output is correct |
19 |
Correct |
76 ms |
3308 KB |
Output is correct |
20 |
Correct |
65 ms |
3308 KB |
Output is correct |
21 |
Correct |
55 ms |
3120 KB |
Output is correct |
22 |
Correct |
55 ms |
2980 KB |
Output is correct |
23 |
Correct |
73 ms |
3380 KB |
Output is correct |
24 |
Correct |
62 ms |
3468 KB |
Output is correct |
25 |
Correct |
58 ms |
3308 KB |
Output is correct |
26 |
Correct |
51 ms |
3056 KB |
Output is correct |
27 |
Incorrect |
65 ms |
3384 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
512 KB |
Output is correct |
7 |
Correct |
7 ms |
640 KB |
Output is correct |
8 |
Correct |
12 ms |
896 KB |
Output is correct |
9 |
Correct |
18 ms |
1356 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
14 ms |
1152 KB |
Output is correct |
12 |
Correct |
20 ms |
1452 KB |
Output is correct |
13 |
Correct |
17 ms |
1460 KB |
Output is correct |
14 |
Correct |
18 ms |
1324 KB |
Output is correct |
15 |
Correct |
58 ms |
3224 KB |
Output is correct |
16 |
Correct |
60 ms |
3220 KB |
Output is correct |
17 |
Correct |
51 ms |
3132 KB |
Output is correct |
18 |
Correct |
51 ms |
3012 KB |
Output is correct |
19 |
Correct |
76 ms |
3308 KB |
Output is correct |
20 |
Correct |
65 ms |
3308 KB |
Output is correct |
21 |
Correct |
55 ms |
3120 KB |
Output is correct |
22 |
Correct |
55 ms |
2980 KB |
Output is correct |
23 |
Correct |
73 ms |
3380 KB |
Output is correct |
24 |
Correct |
62 ms |
3468 KB |
Output is correct |
25 |
Correct |
58 ms |
3308 KB |
Output is correct |
26 |
Correct |
51 ms |
3056 KB |
Output is correct |
27 |
Incorrect |
65 ms |
3384 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
3 ms |
512 KB |
Output is correct |
7 |
Correct |
7 ms |
640 KB |
Output is correct |
8 |
Correct |
12 ms |
896 KB |
Output is correct |
9 |
Correct |
18 ms |
1356 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
14 ms |
1152 KB |
Output is correct |
12 |
Correct |
20 ms |
1452 KB |
Output is correct |
13 |
Correct |
17 ms |
1460 KB |
Output is correct |
14 |
Correct |
18 ms |
1324 KB |
Output is correct |
15 |
Correct |
58 ms |
3224 KB |
Output is correct |
16 |
Correct |
60 ms |
3220 KB |
Output is correct |
17 |
Correct |
51 ms |
3132 KB |
Output is correct |
18 |
Correct |
51 ms |
3012 KB |
Output is correct |
19 |
Correct |
76 ms |
3308 KB |
Output is correct |
20 |
Correct |
65 ms |
3308 KB |
Output is correct |
21 |
Correct |
55 ms |
3120 KB |
Output is correct |
22 |
Correct |
55 ms |
2980 KB |
Output is correct |
23 |
Correct |
73 ms |
3380 KB |
Output is correct |
24 |
Correct |
62 ms |
3468 KB |
Output is correct |
25 |
Correct |
58 ms |
3308 KB |
Output is correct |
26 |
Correct |
51 ms |
3056 KB |
Output is correct |
27 |
Incorrect |
65 ms |
3384 KB |
Wrong Answer [2] |
28 |
Halted |
0 ms |
0 KB |
- |