#include <bits/stdc++.h>
using namespace std;
#include "minerals.h"
void Solve(int types) {
bool side[types * 2];
int sT[types], sF[types], match[types * 2];
for (int i=0; i<types * 2; ++i) {
side[i] = false;
match[i] = 0;
}
int last = 0, sTc = 0, sFc = 0;
for (int i=0; i<types * 2; ++i) {
// if (i + 1 > types * 2 || i < 0) {
// Answer(0, 2);
// }
int curr = Query(i+1);
if (curr > last) {
++last;
sT[sTc] = i+1;
++sTc;
side[i] = true;
} else {
sF[sFc] = i+1;
++sFc;
}
}
bool inside[types];
for (int i = 0; i < types; ++i) {
inside[i] = true;
}
for (int i = 0; i < types; ++i) {
if (sT[i] > 2 * types || sT[i] <= 0) cout<<"scream at me";
}
for (int i = log2(types); i >= 0; --i) {
for (int j = 0; j < types; ++j) {
if (((j & (1<<i)) > 0) == inside[j]) {
last = Query(sT[j]);
inside[j] = !inside[j];
}
}
for (int j = 0; j < types; ++j) {
// if (sF[j] > types * 2 || sF[j] < 1) {
// Answer(sF[0], sF[1]);
// }
int curr = Query(sF[j]);
if (curr != last) {
match[sF[j]-1] |= (1<<i);
last = curr;
}
}
}
for (int i = 0; i < types * 2; ++i) {
if (!side[i]) {
cerr<<match[i]<<' ';
Answer(i+1, sT[match[i]]);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
5 ms |
344 KB |
Output is correct |
3 |
Correct |
9 ms |
600 KB |
Output is correct |
4 |
Correct |
19 ms |
752 KB |
Output is correct |
5 |
Correct |
33 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 |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
5 ms |
344 KB |
Output is correct |
7 |
Correct |
9 ms |
600 KB |
Output is correct |
8 |
Correct |
19 ms |
752 KB |
Output is correct |
9 |
Correct |
33 ms |
1112 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
23 ms |
964 KB |
Output is correct |
12 |
Correct |
34 ms |
1112 KB |
Output is correct |
13 |
Correct |
32 ms |
1052 KB |
Output is correct |
14 |
Correct |
32 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 |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
5 ms |
344 KB |
Output is correct |
7 |
Correct |
9 ms |
600 KB |
Output is correct |
8 |
Correct |
19 ms |
752 KB |
Output is correct |
9 |
Correct |
33 ms |
1112 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
23 ms |
964 KB |
Output is correct |
12 |
Correct |
34 ms |
1112 KB |
Output is correct |
13 |
Correct |
32 ms |
1052 KB |
Output is correct |
14 |
Correct |
32 ms |
1112 KB |
Output is correct |
15 |
Correct |
92 ms |
2384 KB |
Output is correct |
16 |
Correct |
114 ms |
2284 KB |
Output is correct |
17 |
Correct |
81 ms |
2460 KB |
Output is correct |
18 |
Correct |
82 ms |
2188 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 |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
5 ms |
344 KB |
Output is correct |
7 |
Correct |
9 ms |
600 KB |
Output is correct |
8 |
Correct |
19 ms |
752 KB |
Output is correct |
9 |
Correct |
33 ms |
1112 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
23 ms |
964 KB |
Output is correct |
12 |
Correct |
34 ms |
1112 KB |
Output is correct |
13 |
Correct |
32 ms |
1052 KB |
Output is correct |
14 |
Correct |
32 ms |
1112 KB |
Output is correct |
15 |
Correct |
92 ms |
2384 KB |
Output is correct |
16 |
Correct |
114 ms |
2284 KB |
Output is correct |
17 |
Correct |
81 ms |
2460 KB |
Output is correct |
18 |
Correct |
82 ms |
2188 KB |
Output is correct |
19 |
Incorrect |
14 ms |
1880 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
5 ms |
344 KB |
Output is correct |
7 |
Correct |
9 ms |
600 KB |
Output is correct |
8 |
Correct |
19 ms |
752 KB |
Output is correct |
9 |
Correct |
33 ms |
1112 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
23 ms |
964 KB |
Output is correct |
12 |
Correct |
34 ms |
1112 KB |
Output is correct |
13 |
Correct |
32 ms |
1052 KB |
Output is correct |
14 |
Correct |
32 ms |
1112 KB |
Output is correct |
15 |
Correct |
92 ms |
2384 KB |
Output is correct |
16 |
Correct |
114 ms |
2284 KB |
Output is correct |
17 |
Correct |
81 ms |
2460 KB |
Output is correct |
18 |
Correct |
82 ms |
2188 KB |
Output is correct |
19 |
Incorrect |
14 ms |
1880 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
5 ms |
344 KB |
Output is correct |
7 |
Correct |
9 ms |
600 KB |
Output is correct |
8 |
Correct |
19 ms |
752 KB |
Output is correct |
9 |
Correct |
33 ms |
1112 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
23 ms |
964 KB |
Output is correct |
12 |
Correct |
34 ms |
1112 KB |
Output is correct |
13 |
Correct |
32 ms |
1052 KB |
Output is correct |
14 |
Correct |
32 ms |
1112 KB |
Output is correct |
15 |
Correct |
92 ms |
2384 KB |
Output is correct |
16 |
Correct |
114 ms |
2284 KB |
Output is correct |
17 |
Correct |
81 ms |
2460 KB |
Output is correct |
18 |
Correct |
82 ms |
2188 KB |
Output is correct |
19 |
Incorrect |
14 ms |
1880 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
5 ms |
344 KB |
Output is correct |
7 |
Correct |
9 ms |
600 KB |
Output is correct |
8 |
Correct |
19 ms |
752 KB |
Output is correct |
9 |
Correct |
33 ms |
1112 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
23 ms |
964 KB |
Output is correct |
12 |
Correct |
34 ms |
1112 KB |
Output is correct |
13 |
Correct |
32 ms |
1052 KB |
Output is correct |
14 |
Correct |
32 ms |
1112 KB |
Output is correct |
15 |
Correct |
92 ms |
2384 KB |
Output is correct |
16 |
Correct |
114 ms |
2284 KB |
Output is correct |
17 |
Correct |
81 ms |
2460 KB |
Output is correct |
18 |
Correct |
82 ms |
2188 KB |
Output is correct |
19 |
Incorrect |
14 ms |
1880 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
5 ms |
344 KB |
Output is correct |
7 |
Correct |
9 ms |
600 KB |
Output is correct |
8 |
Correct |
19 ms |
752 KB |
Output is correct |
9 |
Correct |
33 ms |
1112 KB |
Output is correct |
10 |
Correct |
2 ms |
344 KB |
Output is correct |
11 |
Correct |
23 ms |
964 KB |
Output is correct |
12 |
Correct |
34 ms |
1112 KB |
Output is correct |
13 |
Correct |
32 ms |
1052 KB |
Output is correct |
14 |
Correct |
32 ms |
1112 KB |
Output is correct |
15 |
Correct |
92 ms |
2384 KB |
Output is correct |
16 |
Correct |
114 ms |
2284 KB |
Output is correct |
17 |
Correct |
81 ms |
2460 KB |
Output is correct |
18 |
Correct |
82 ms |
2188 KB |
Output is correct |
19 |
Incorrect |
14 ms |
1880 KB |
Wrong Answer [2] |
20 |
Halted |
0 ms |
0 KB |
- |