This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
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... |