#include <bits/stdc++.h>
using namespace std;
#define y0 y1231
#define y1 y132131
int n,x,y,x0,y0,x1,y1,x2,y2,x3,y3;
bool Ask(int X,int Y){
printf("examine %d %d\n",X,Y);
fflush(stdout);
char s[6];
scanf("%s",s);
return s[0]=='t';
}
int main(){
scanf("%d%d%d",&n,&x,&y);
int low=0,high=x-1,ans=0;
while(low<=high){
int mid=(low+high)/2;
if(Ask(x-mid,y))ans=mid,low=mid+1;
else high=mid-1;
}
x0=x-ans,y0=y;
{
int low=0,high=n-x-1,ans=0;
while(low<=high){
int mid=(low+high)>>1;
if(Ask(x+mid,y))ans=mid,low=mid+1;
else high=mid-1;
}
x1=x+ans,y1=y;
}
{
int low=0,high=y-1,ans=0;
while(low<=high){
int mid=(low+high)>>1;
if(Ask(x,y-mid))ans=mid,low=mid+1;
else high=mid-1;
}
x2=x,y2=y-ans;
}
{
int low=0,high=n-y-1,ans=0;
while(low<=high){
int mid=(low+high)>>1;
if(Ask(x,y+mid))ans=mid,low=mid+1;
else high=mid-1;
}
x3=x,y3=y+ans;
}
int lx=x1-x0+1,ly=y3-y2+1;
for(int d:{1,3,5}){
if(lx%d!=0)continue;
int m=lx/d;
if(ly%m!=0||(ly/d!=1&&ly/m!=3&&ly/m!=5))continue;
if(m%2==0)continue;
int xl=x0,xr=x1,yl=y2,yr=y3;
while(xl>2*m){
if(Ask(xl-2*m,y)||(y>m&&Ask(x1-2*m,y-m)||(y<=m&&y+m<=n&&Ask(x1-2*m,y+m))))xl-=2*m;
else break;
}
while(xr+2*m<=n){
if(Ask(xr+2*m,y)||(y>m&&Ask(xr+2*m,y-m)||(y<=m&&y+m<=n&&Ask(xr+2*m,y+m))))xr+=2*m;
else break;
}
while(yl>2*m){
if(Ask(x,yl-2*m)||(x>m&&Ask(x-m,yl-2*m)||(x<=m&&x+m<=n&&Ask(x+m,yl-2*m))))yl-=2*m;
else break;
}
while(yr+2*m<=n){
if(Ask(x,yr+2*m)||(x>m&&Ask(x-m,yr+2*m)||(x<=m&&x+m<=n&&Ask(x+m,yr+2*m))))yr+=2*m;
else break;
}
if(xr-xl+1==5*m&&yr-yl+1==5*m){
printf("solution %d %d",xl+2*m+m/2,yl+2*m+m/2);
fflush(stdout);
return 0;
}
}
assert(false);
return 0;
}
Compilation message
aliens.cpp: In function 'int main()':
aliens.cpp:57:26: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
57 | if(Ask(xl-2*m,y)||(y>m&&Ask(x1-2*m,y-m)||(y<=m&&y+m<=n&&Ask(x1-2*m,y+m))))xl-=2*m;
| ~~~^~~~~~~~~~~~~~~~~
aliens.cpp:61:26: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
61 | if(Ask(xr+2*m,y)||(y>m&&Ask(xr+2*m,y-m)||(y<=m&&y+m<=n&&Ask(xr+2*m,y+m))))xr+=2*m;
| ~~~^~~~~~~~~~~~~~~~~
aliens.cpp:65:26: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
65 | if(Ask(x,yl-2*m)||(x>m&&Ask(x-m,yl-2*m)||(x<=m&&x+m<=n&&Ask(x+m,yl-2*m))))yl-=2*m;
| ~~~^~~~~~~~~~~~~~~~~
aliens.cpp:69:26: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
69 | if(Ask(x,yr+2*m)||(x>m&&Ask(x-m,yr+2*m)||(x<=m&&x+m<=n&&Ask(x+m,yr+2*m))))yr+=2*m;
| ~~~^~~~~~~~~~~~~~~~~
aliens.cpp: In function 'bool Ask(int, int)':
aliens.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
10 | scanf("%s",s);
| ~~~~~^~~~~~~~
aliens.cpp: In function 'int main()':
aliens.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
14 | scanf("%d%d%d",&n,&x,&y);
| ~~~~~^~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Runtime error |
1 ms |
464 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Runtime error |
1 ms |
464 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
444 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Runtime error |
2 ms |
464 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
464 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Runtime error |
2 ms |
336 KB |
Execution killed with signal 6 |
4 |
Halted |
0 ms |
0 KB |
- |