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;
string rep;
//do binary search to find top line of any block
int low=y0,high=n+1;
while(high-low>1){
int mid=(high+low)/2;
cout<<"examine "<<x0<<' '<<mid<<endl;
cin>>rep;
if(rep=="false")
high=mid;
else
low=mid;
}
y0=low;
low=x0,high=n+1;
while(high-low>1){
int mid=(high+low)/2;
cout<<"examine "<<mid<<' '<<y0<<endl;
cin>>rep;
if(rep=="false")
high=mid;
else
low=mid;
}
x0=low;
//want to bottom corner how must should be subtracted
low=0,high=min(x0,y0);
while(high-low>1){
int mid=(low+high)/2;
cout<<"examine "<<x0-mid<<' '<<y0-mid<<endl;
cin>>rep;
if(rep=="false")
high=mid;
else
low=mid;
}
x0-=low;
y0-=low;
low=0,high=(n+1)-max(x0,y0);
while(high-low>1){
int mid=(high+low)/2;
cout<<"examine "<<x0+mid<<' '<<y0+mid<<endl;
cin>>rep;
if(rep=="false")
high=mid;
else
low=mid;
}
x0+=low/2;
y0+=low/2;
//now we are in the main diagonal
high=min(y0,(n+1)-x0);
low=0;
while(high-low>1){
int mid=(high+low)/2;
cout<<"examine "<<x0+mid<<' '<<y0-mid<<endl;
cin>>rep;
if(rep=="false")
high=mid;
else
low=mid;
}
x0+=low;
y0-=low;
// cout<<x0<<' '<<y0<<endl;
high=min(x0,(n+1)-y0);
low=0;
while(high-low>1){
int mid=(high+low)/2;
cout<<"examine "<<x0-mid<<' '<<y0+mid<<endl;
cin>>rep;
if(rep=="false")
high=mid;
else
low=mid;
}
x0-=low/2;
y0+=low/2;
cout<<"solution "<<x0<<' '<<y0<<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... |