#include "park.h"
#include <bits/stdc++.h>
using namespace std;
static int Place[1400];
void Detect(int T, int n) {
vector<bool> done(n);
done[0] = true;
function<void(int)> Solve = [&](int v) {
if (done[v]) {
return;
}
while (true) {
for (int i = 0; i < n; i++) {
Place[i] = done[i] ? 1 : 0;
}
Place[v] = 1;
if (Ask(0, v, Place)) {
break;
}
int low = 0, high = n - 1, p = -1;
while (low <= high) {
int mid = (low + high) >> 1;
for (int i = 0; i < n; i++) {
if (done[i] || i == v || i <= mid) {
Place[i] = 1;
} else {
Place[i] = 0;
}
}
if (Ask(0, v, Place)) {
p = mid;
high = mid - 1;
} else {
low = mid + 1;
}
}
Solve(p);
}
int low = 0, high = n - 1, p = -1;
while (low <= high) {
int mid = (low + high) >> 1;
for (int i = 0; i < n; i++) {
if (i <= mid && done[i]) {
Place[i] = 1;
} else {
Place[i] = 0;
}
}
Place[v] = 1;
if (Ask(0, v, Place)) {
p = mid;
high = mid - 1;
} else {
low = mid + 1;
}
}
Answer(min(p, v), max(p, v));
done[v] = true;
};
for (int i = 1; i < n; i++) {
if (!done[i]) {
Solve(i);
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Wrong Answer[2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Wrong Answer[2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Wrong Answer[2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Wrong Answer[2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Wrong Answer[2] |
2 |
Halted |
0 ms |
0 KB |
- |