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;
int main()
{
string rez;
long long st2[30];st2[0]=1;
for (long long i=1;i<30;i++) st2[i]=st2[i-1]*2;
long long n,x0,y0;
cin>>n>>x0>>y0;
long long eksponentdesno=0;
for (long long i=0;i<30;i++)
{
if (x0+st2[i]>n) break;
cout<<"examine "<<x0+st2[i]<<" "<<y0<<endl;cin>>rez;
if (rez=="true") eksponentdesno=st2[i];
else break;
}
long long ldesno=eksponentdesno;
long long rdesno=min(2*eksponentdesno,n-x0);
long long rezdesno=x0;
while (ldesno<=rdesno)
{
long long mid=(ldesno+rdesno)/2;
cout<<"examine "<<x0+mid<<" "<<y0<<endl;cin>>rez;
if (rez=="true") {rezdesno=mid;ldesno=mid+1;}
else rdesno=mid-1;
}
long long desno=x0+rezdesno;
long long eksponentlevo=0;
for (long long i=0;i<30;i++)
{
if (x0-st2[i]<=0) break;
cout<<"examine "<<x0-st2[i]<<" "<<y0<<endl;cin>>rez;
if (rez=="true") eksponentlevo=st2[i];
else break;
}
long long llevo=eksponentlevo;
long long rlevo=min(eksponentlevo*2,x0);
long long rezlevo=y0;
while (llevo<=rlevo)
{
long long mid=(llevo+rlevo)/2;
cout<<"examine "<<x0-mid<<" "<<y0<<endl;cin>>rez;
if (rez=="true") {rezlevo=mid;llevo=mid+1;}
else rlevo=mid-1;
}
long long levo=x0-rezlevo;
long long m=desno-levo+1;
long long lgore=0,rgore=min(m,y0-1);
long long rezgore=0;
while (lgore<rgore)
{
long long mid=(lgore+rgore)/2;
cout<<"examine "<<x0<<" "<<y0-mid<<endl;cin>>rez;
if (rez=="true") {rezgore=mid;lgore=mid+1;}
else rgore=mid-1;
}
long long gore=y0-rezgore;
long long dole=gore+m-1;
long long centarx=(levo+desno)/2;
long long centary=(gore+dole)/2;
vector<pair<long long,long long>> ans;
for (long long i=-2;i<=2;i++)
{
for (long long j=-2;j<=2;j++)
{
long long pozx=centarx+i*m;
long long pozy=centary+j*m;
if (pozx<1 or pozx>n) continue;
if (pozy<1 or pozy>n) continue;
cout<<"examine "<<pozx<<" "<<pozy<<endl;cin>>rez;
if (rez=="true") ans.push_back({pozx,pozy});
}
}
sort(ans.begin(),ans.end());
cout<<"solution "<<ans[6].first<<" "<<ans[6].second<<endl;
}
# | 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... |