#include <bits/stdc++.h>
using namespace std;
long long n,x,y,m=1,b,e;
char q[15];
int main()
{
cin>>n>>x>>y;
if(x>1)
{
cout<<"examine "<<x-m<<' '<<y<<'\n';
cout.flush();
cin>>q;
while(q[0]=='t')
{
m*=2;
cout<<"examine "<<x-m<<' '<<y<<'\n';
cout.flush();
cin>>q;
}
m/=2;
}
b=m,e=min(m*2,x-1);
while(b<=e)
{
int mid=(b+e)/2;
cout<<"examine "<<x-mid<<' '<<y<<'\n';
cout.flush();
cin>>q;
if(q[0]=='t')
b=mid+1;
else
e=mid-1;
}
x=x-e;
m=1;
cout<<"examine "<<x+m<<' '<<y<<'\n';
cout.flush();
cin>>q;
while(q[0]=='t')
{
m*=2;
cout<<"examine "<<x+m<<' '<<y<<'\n';
cout.flush();
cin>>q;
}
m/=2;
b=m,e=min(m*2,n-x);
while(b<=e)
{
int mid=(b+e)/2;
cout<<"examine "<<x+mid<<' '<<y<<'\n';
cout.flush();
cin>>q;
if(q[0]=='t')
b=mid+1;
else
e=mid-1;
}
m=b;
b=0,e=m-1;
while(b<=e)
{
int mid=(b+e)/2;
cout<<"examine "<<x<<' '<<y-mid<<'\n';
cout.flush();
cin>>q;
if(q[0]=='t')
b=mid+1;
else
e=mid-1;
}
y-=e;
while(x>m&&y>m)
{
cout<<"examine "<<x-m<<' '<<y-m<<'\n';
cout.flush();
cin>>q;
if(q[0]=='t')
{
x-=m;
y-=m;
}
else
break;
}
while(x>m*2)
{
cout<<"examine "<<x-m*2<<' '<<y<<'\n';
cout.flush();
cin>>q;
if(q[0]=='t')
{
x-=m*2;
}
else
break;
}
while(y>m*2)
{
cout<<"examine "<<x<<' '<<y-m*2<<'\n';
cout.flush();
cin>>q;
if(q[0]=='t')
{
y-=m*2;
}
else
break;
}
cout<<"solution "<<x+2*m+m/2<<' '<<y+2*m+m/2<<'\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
2 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |