#include <bits/stdc++.h>
using namespace std;
bool ask(int x, int y){
cout << "examine " << x << " " << y << endl;
string str; cin >> str;
if (str == "true") return true;
else return false;
}
int main() {
int n, x0, y0; cin >> n >> x0 >> y0;
int xt = x0, yt = y0, xb = x0;
int x = 1;
while (xt - x >= 1 && ask(xt - x, y0)) xt -= x, x *= 2;
int l = xt - x, r = xt;
while (l <= r){
int mid = (l + r) / 2;
if (mid >= 1 && ask(mid, y0)) xt = mid, r = mid - 1;
else l = mid + 1;
}
x = 1;
while (xb + x <= n && ask(xb + x, y0)) xb += x, x *= 2;
l = xb, r = xb + x;
while (l <= r){
int mid = (l + r) / 2;
if (mid <= n && ask(mid, y0)) xb = mid, l = mid + 1;
else r = mid - 1;
}
x = 1;
while (yt - x >= 1 && ask(x0, yt - x)) yt -= x, x *= 2;
l = yt - x, r = yt;
while (l <= r){
int mid = (l + r) / 2;
if (mid >= 1 && ask(x0, mid)) yt = mid, r = mid - 1;
else l = mid + 1;
}
int sz = xb - xt + 1;
while (xt - 2*sz >= 1 && ask(xt - 2*sz, yt)) xt = xt - 2*sz;
while (true){
if (xt - sz >= 1 && yt - sz >= 1 && ask(xt - sz, yt - sz)) xt = xt - sz, yt = yt - sz;
else if (xt + sz <= n && yt - sz >= 1 && ask(xt + sz, yt - sz)) xt = xt + sz, yt = yt - sz;
else break;
}
int xres = xt + 2*sz + sz / 2;
int yres = yt + 2*sz + sz / 2;
cout << "solution " << xres << " " << yres << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
2 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
2 ms |
208 KB |
Output is correct |
3 |
Correct |
2 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
3 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
208 KB |
Output is correct |
2 |
Runtime error |
3 ms |
208 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
208 KB |
Output is correct |
2 |
Runtime error |
4 ms |
336 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |