#include <bits/stdc++.h>
#define int long long
using namespace std;
int n, m, x, y;
int d[] = {-4, -3, -2, -1, 1, 2, 3, 4};
bool ask(int x, int y){
if(x < 1 || x > n || y < 1 || y > n) return false;
cout << "examine " << x << " " << y << endl;
string s; cin >> s;
return (s == "true");
}
int find(int a, int b){
int tmp = 1;
while(ask(x + a*tmp, y + b*tmp)) tmp <<= 1LL;
int l = (tmp>>1LL), r = tmp;
int ret = l;
while(l <= r){
int mid = (l + r)/2LL;
if(ask(x + a*mid, y + b*mid)){
l = mid + 1;
ret = mid;
} else{
r = mid - 1;
}
}
return ret;
}
int32_t main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> x >> y;
int L = x - find(-1, 0), R = x + find(1, 0), T = y + find(0, 1), B = y - find(0, -1);
int mx = (L + R)/2LL, my = (T + B)/2LL;
int M = (R - L + 1);
int x = mx, y = my;
while(ask(x, y)) x -= 2LL*M;
int left = (x + 2LL*M);
x = mx, y = my;
while(ask(x, y)) x += 2LL*M;
int right = (x - 2LL*M);
x = mx, y = my;
while(ask(x, y)) y -= 2LL*M;
int bottom = (y - 2LL*M);
x = mx, y = my;
while(ask(x, y)) y += 2LL*M;
int top = (y + 2LL*M);
int ansX = (left + right)/2LL, ansY = (top + bottom)/2LL;
cout << "solution " << ansX << " " << ansY << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
0 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 |
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 |
2 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 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 |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
3 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 |
1 ms |
288 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
3 ms |
208 KB |
Output is correct |