#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;fflush(stdout);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;fflush(stdout);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;fflush(stdout);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;fflush(stdout);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;fflush(stdout);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;fflush(stdout);cin>>rez;
if (rez=="true") ans.push_back({pozx,pozy});
}
}
sort(ans.begin(),ans.end());
cout<<"solution "<<ans[6].first<<" "<<ans[6].second<<endl;fflush(stdout);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |