#include<bits/stdc++.h>
using namespace std;
int main(){
long long int n,xx,yy;
int che=1;
cin>>n>>xx>>yy;
long long j=2;
string s;
while(che==1){
che=0;
if(xx+j-1<=n){
cout<<"examine"<<" "<<xx+j-1<<" "<<yy<<endl;
cin>>s;
if(s[0]=='t')
che=1;
}
if(che==1)
j*=2;
}
int l=j/2-1;
int r=min(n-xx,j-2);
while(l!=r){
int mid=(l+r+1)/2;
cout<<"examine"<<" "<<xx+mid<<" "<<yy<<endl;
string s;
cin>>s;
if(s[0]=='t')
l=mid;
else
r=mid-1;
}
j=2;
che=1;
while(che==1){
che=0;
if(xx-j+1>=0){
cout<<"examine"<<" "<<xx-j+1<<" "<<yy<<endl;
cin>>s;
if(s[0]=='t')
che=1;
}
if(che==1)
j*=2;
}
int ll=j/2-1;
int rr=min(xx-1,j-2);
while(ll!=rr){
int mid=(ll+rr+1)/2;
cout<<"examine"<<" "<<xx-mid<<" "<<yy<<endl;
string s;
cin>>s;
if(s[0]=='t')
ll=mid;
else
rr=mid-1;
}
int m=ll+l+1;
int x=(xx-ll+xx+l)/2;
che=1;
j=2;
while(che==1){
che=0;
if(yy+j-1<=n){
cout<<"examine"<<" "<<xx<<" "<<yy+j-1<<endl;
cin>>s;
if(s[0]=='t')
che=1;
}
if(che==1)
j*=2;
}
l=j/2-1;
r=min(n-yy,j-2);
while(l!=r){
int mid=(l+r+1)/2;
cout<<"examine"<<" "<<xx<<" "<<yy+mid<<endl;
string s;
cin>>s;
if(s[0]=='t')
l=mid;
else
r=mid-1;
}
int y=yy+l-(m/2);
cout<<x<<y;
che=0;
if(x+2*m<=n){
string s;
cout<<"examine"<<" "<<x+2*m<<" "<<y<<endl;
cin>>s;
if(s[0]=='t')
che=1;
}
if(che==0){
che=0;
if(y+2*m<=n){
string s;
cout<<"examine"<<" "<<x<<" "<<y+2*m<<endl;
cin>>s;
if(s[0]=='t')
che=1;
}
if(che==0){
che=0;
if(x-4*m>0){
string s;
cout<<"examine"<<" "<<x-4*m<<" "<<y<<endl;
cin>>s;
if(s[0]=='t')
che=1;
}
if(che==0){
x-=m;
y-=m;
cout<<"solution"<<" "<<x<<" "<<y<<endl;
return 0;
}
if(che==1){
x-=2*m;
y-=2*m;
cout<<"solution"<<" "<<x<<" "<<y<<endl;
return 0;
}
}
else{
che=0;
if(y-2*m>0){
string s;
cout<<"examine"<<" "<<x<<" "<<y-2*m<<endl;
cin>>s;
if(s[0]=='t')
che=1;
}
if(che==0){
if(x-4*m>0){
string s;
cout<<"examine"<<" "<<x-4*m<<" "<<y<<endl;
cin>>s;
if(s[0]=='t')
che=1;
}
if(che==0){
x-=m;
y+=m;
cout<<"solution"<<" "<<x<<" "<<y<<endl;
return 0;
}
else{
x-=2*m;
y+=2*m;
cout<<"solution"<<" "<<x<<" "<<y<<endl;
return 0;
}
}
else{
x-=2*m;
cout<<"solution"<<" "<<x<<" "<<y<<endl;
return 0;
}
}
}
else{
che=0;
if(y+2*m<=n){
string s;
cout<<"examine"<<" "<<x<<" "<<y+2*m<<endl;
cin>>s;
if(s[0]=='t')
che=1;
}
if(che==0){
if(x-2*m>0){
string s;
cout<<"examine"<<" "<<x-2*m<<" "<<y<<endl;
cin>>s;
if(s[0]=='t')
che=1;
}
if(che==0){
if(x+4*m<=n){
string s;
cout<<"examine"<<" "<<x+4*m<<" "<<y<<endl;
cin>>s;
if(s[0]=='t')
che=1;
}
if(che==0){
x+=m;
y-=m;
cout<<"solution"<<" "<<x<<" "<<y<<endl;
return 0;
}
else{
x+=2*m;
y-=2*m;
cout<<"solution"<<" "<<x<<" "<<y<<endl;
return 0;
}
}
else{
y-=2*m;
cout<<"solution"<<" "<<x<<" "<<y<<endl;
return 0;
}
}
else{
che=0;
if(x-2*m>0){
string s;
cout<<"examine"<<" "<<x-2*m<<" "<<y<<endl;
cin>>s;
if(s[0]=='t')
che=1;
}
if(che==0){
if(y-2*m>0){
string s;
cout<<"examine"<<" "<<x<<" "<<y-2*m<<endl;
cin>>s;
if(s[0]=='t')
che=1;
}
if(che==0){
if(x-m>0&&y-m>0){
string s;
cout<<"examine"<<" "<<x-m<<" "<<y-m<<endl;
cin>>s;
if(s[0]=='t')
che=1;
}
if(che==0){
x+=2*m;
y+=2*m;
cout<<"solution"<<" "<<x<<" "<<y<<endl;
return 0;
}
else{
x+=m;
y+=m;
cout<<"solution"<<" "<<x<<" "<<y<<endl;
return 0;
}
}
else{
cout<<"solution"<<" "<<x+2*m<<" "<<y<<endl;
return 0;
}
}
else{
che=0;
if(y-2*m>0){
string s;
cout<<"examine"<<" "<<x<<" "<<y-2*m<<endl;
cin>>s;
if(s[0]=='t')
che=1;
}
if(che==0){
cout<<"solution"<<" "<<x<<" "<<y+2*m<<endl;
return 0;
}
else{
cout<<"solution"<<" "<<x<<" "<<y<<endl;
return 0;
}
}
}
}
}
# |
결과 |
실행 시간 |
메모리 |
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 |
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 |
# |
결과 |
실행 시간 |
메모리 |
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 |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 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 |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
596 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |