#include <bits/stdc++.h>
#define int long long
int lim,x,y;
int u,d,l,r;
int USE = 0;
bool test(int tx,int ty){
USE++;
if(tx>lim||ty>lim||tx<0||ty<0)return false;
std::cout << "examine " << tx << ' ' << ty << std::endl;
std::string in;
std::cin >> in;
// if(ty>=max)return false;
// else return true;
return in[0]=='t';
}
void ans(int tx,int ty){
std::cout << "solution " << tx << ' ' << ty << std::endl;
}
bool up(int x,int y,int t){return test(x,y+t);}
bool down(int x,int y,int t){return test(x,y-t);}
bool left(int x,int y,int t){return test(x-t,y);}
bool right(int x,int y,int t){return test(x+t,y);}
int find(std::function<bool(int,int,int)> f){
int l=1,h=-1;
int last=l;
while(h==-1){
if(f(x,y,l)){
last=l;
l*=2;
}
else{
h = l;
}
}
l=last;
while(l<h){
int mid = (l+h+1)/2;
if(f(x,y,mid)){
l = mid;
}
else{
h = mid-1;
}
}
return l;
}
void fans(int cmx,int cmy,int m){
int tr=2;
int xd=1;
int yd=1;
if(test(cmx+2*m,cmy))xd+=1;
if(test(cmx+2*2*m,cmy))xd+=1;
if(test(cmx,cmy+2*m))yd+=1;
if(test(cmx,cmy+2*2*m))yd+=1;
if((xd==1&&yd==2)||(xd==1&&yd==1)||(xd==2&&yd==1)){
if(test(cmx+m,cmy+m)){
int ax,ay;
if(xd==1)ax = cmx-m;
else ax = cmx+m;
if(yd==1)ay = cmy-m;
else ay = cmy + m;
ans(ax,ay);
}
else{
ans(cmx-(2-xd)*2*m,cmy-(2-yd)*2*m);
}
}
else if(xd==2&&yd==2){
if(test(cmx-3*m,cmy-3*m)){
ans(cmx,cmy);
}
else{
ans(cmx+m,cmy+m);
}
}
}
signed main() {
std::ios::sync_with_stdio(false);std::cin.tie(nullptr);
std::cin >> lim >> x >> y;
int u = find(up);
int l = find(left);
int r = find(right);
int d = find(down);
int m = (1+l+r);
int cmx = x-l+m/2;
int cmy = x-d+m/2;
fans(cmx,cmy,m);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |