#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define f first
#define s second
using namespace std;
int n, x, y, m;
bool interact(int xx, int yy) {
if(xx==x && yy==y) return 1;
printf("examine %d %d\n", xx, yy);
string s;
cin>>s;
return s[0]=='t';
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n>>x>>y;
int l, r, two;
two = 1;
while(x+two<=n && interact(x+two, y)) two *= 2;
l = x+(two/2);
r = min(x+two, n);
while(l<r) {
int mid = (l+r+1)/2;
if(interact(mid, y)) l = mid;
else r = mid-1;
}
int right = l;
two = 1;
while(x-two>=1 && interact(x-two, y)) two *= 2;
l = max(x-two, 1);
r = x-(two/2);
while(l<r) {
int mid = (l+r)/2;
if(interact(mid, y)) r = mid;
else l = mid+1;
}
int left = l;
two = 1;
while(y+two<=n && interact(x, y+two)) two *= 2;
l = y+(two/2);
r = min(y+two, n);
while(l<r) {
int mid = (l+r+1)/2;
if(interact(x, mid)) l = mid;
else r = mid-1;
}
int top = l;
two = 1;
while(y-two>=1 && interact(x, y-two)) two *= 2;
l = max(y-two, 1);
r = y-(two/2);
while(l<r) {
int mid = (l+r)/2;
if(interact(x, mid)) r = mid;
else l = mid+1;
}
int bottom = l;
m = right+1-left;
int xc = (left+right)/2;
int yc = (top+bottom)/2;
if(xc+(4*m)<=n && interact(xc+(4*m), yc)) {
xc += 2*m;
if(yc+(4*m)<=n && interact(xc, yc+(4*m))) {
yc += 2*m;
} else if(yc-(4*m)>=1 && interact(xc, yc-(4*m))) {
yc -= 2*m;
}
} else if(xc-(4*m)>=1 && interact(xc-(4*m), yc)) {
xc -= 2*m;
if(yc+(4*m)<=n && interact(xc, yc+(4*m))) {
yc += 2*m;
} else if(yc-(4*m)>=1 && interact(xc, yc-(4*m))) {
yc -= 2*m;
}
} else if(yc+(4*m)<=n && interact(xc, yc+(4*m))) {
yc += 2*m;
} else if(yc-(4*m)>=1 && interact(xc, yc-(4*m))) {
yc -= 2*m;
} else {
bool bl = ((xc-(2*m)>=1) && interact(xc-(2*m), yc));
bool br = ((xc+(2*m)<=n) && interact(xc+(2*m), yc));
if(bl && !br) {
xc -= m;
if(yc+(3*m)<=n && interact(xc, yc+(3*m))) {
yc += m;
} else if(yc-(3*m)>=1 && interact(xc, yc-(3*m))) {
yc -= m;
}
} else if(br && !bl) {
xc += m;
if(yc+(3*m)<=n && interact(xc, yc+(3*m))) {
yc += m;
} else if(yc-(3*m)>=1 && interact(xc, yc-(3*m))) {
yc -= m;
}
}
}
printf("solution %d %d", xc, yc);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
208 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |