#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int n,x0,y0;
cin>>n>>x0>>y0;
//step1 is find M and center (to save query)
//find center x take at most 101 query
int bx=x0-1,ux=x0+1;
string rep;
while(bx>0){
cout<<"examine "<<bx<<' '<<y0<<endl;
cin>>rep;
if(rep=="false")
break;
else
bx--;
}
while(ux<=n){
cout<<"examine "<<ux<<' '<<y0<<endl;
cin>>rep;
if(rep=="false")
break;
else
ux++;
}
//find center y take at most 101 query
int by=y0-1,uy=y0+1;
while(by>0){
cout<<"examine "<<x0<<' '<<by<<endl;
cin>>rep;
if(rep=="false")
break;
else
by--;
}
while(uy<=n){
cout<<"examine "<<x0<<' '<<uy<<endl;
cin>>rep;
if(rep=="false")
break;
else
uy++;
}
int cx=(bx+ux)/2;
int cy=(by+uy)/2;
int m=(ux-bx)-1;
//successfully found center of the current block and M as well
//find coordinates of its current block
int curx=cx-(2*m),cury=cy-(2*m);
int xcor=0,ycor=0;
while(curx>0){
cout<<"examine "<<curx<<' '<<cy<<endl;
cin>>rep;
if(rep=="false")
break;
else{
curx-=2*m;
xcor--;
}
}
while(cury>0){
cout<<"examine "<<cx<<' '<<cury<<endl;
cin>>rep;
if(rep=="false")
break;
else{
cury-=2*m;
ycor--;
}
}
//above
curx=cx+(2*m);
cury=cy+(2*m);
while(curx<=n){
cout<<"examine "<<curx<<' '<<cy<<endl;
cin>>rep;
if(rep=="false")
break;
else{
curx+=2*m;
xcor++;
}
}
while(cury<=n){
cout<<"examine "<<cx<<' '<<cury<<endl;
cin>>rep;
if(rep=="false")
break;
else{
cury+=2*m;
ycor++;
}
}
cx+=(m*xcor);
cy+=(m*ycor);
cout<<"solution "<<cx<<' '<<cy<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
440 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Runtime error |
1 ms |
432 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Runtime error |
1 ms |
440 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
436 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
432 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
440 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |