#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
mt19937 gen(239);
int last;
bool query(int x) {
int cur = Query(x);
bool res = cur != last;
last = cur;
return res;
}
void solve(vector<int> a, vector<int> b, bool f) {
int n = a.size();
if (n == 1) {
Answer(a[0], b[0]);
return;
}
int m = n / 2;
vector<int> a1, a2, b1, b2;
for (int i = 0; i < m; ++i) {
Query(a[i]);
a1.push_back(a[i]);
}
for (int i = m; i < n; ++i) {
a2.push_back(a[i]);
}
for (int i = 0; i < n; ++i) {
if (b1.size() == a1.size()) {
b2.push_back(b[i]);
continue;
}
if (b2.size() == a2.size()) {
b1.push_back(b[i]);
continue;
}
if (query(b[i]) ^ f) {
b2.push_back(b[i]);
} else {
b1.push_back(b[i]);
}
}
solve(a1, b1, f);
solve(a2, b2, !f);
}
void Solve(int N) {
vector<int> a, b;
last = 0;
for (int i = 1; i <= 2 * N; ++i) {
if (query(i)) {
a.push_back(i);
} else {
b.push_back(i);
}
}
solve(a, b, false);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |