#include <bits/stdc++.h>
using namespace std;
#define int long long
#define y0 y1231
#define y1 y132131
int n,x,y,x0,y0,x1,y1,x2,y2,x3,y3;
bool Ask(int X,int Y){
//assert(1<=X&&X<=n&&1<=Y&&Y<=n);
printf("examine %lld %lld\n",X,Y);
fflush(stdout);
char s[6];
scanf("%s",s);
return s[0]=='t';
}
signed main(){
scanf("%lld%lld%lld",&n,&x,&y);
{
int low=0,high=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;
}
x0=x-ans,y0=y;
}
{
int low=0,high=n-x,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,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/m!=1&&ly/m!=3&&ly/m!=5))continue;
if(m%2==0)continue;
int xl=x0,xr=x1,yl=y2,yr=y3;
while(xl>m){
if(Ask(xl-m,y)||((y>m&&Ask(xl-m,y-m))||(y+m<=n&&Ask(xl-m,y+m))))xl-=m;
else break;
}
while(xr+m<=n){
if(Ask(xr+m,y)||((y>m&&Ask(xr+m,y-m))||(y+m<=n&&Ask(xr+m,y+m))))xr+=m;
else break;
}
while(yl>m){
if(Ask(x,yl-m)||((x>m&&Ask(x-m,yl-m))||(x+m<=n&&Ask(x+m,yl-m))))yl-=m;
else break;
}
while(yr+m<=n){
if(Ask(x,yr+m)||((x>m&&Ask(x-m,yr+m))||(x+m<=n&&Ask(x+m,yr+m))))yr+=m;
else break;
}
int tx=xr-xl+1,ty=yr-yl+1;
if(tx==5*m&&ty==5*m){
printf("solution %lld %lld",(xl+xr)/2,(yl+yr)/2);
fflush(stdout);
return 0;
}
}
//assert(false);
return 0;
}
Compilation message
aliens.cpp: In function 'bool Ask(long long int, long long int)':
aliens.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
12 | scanf("%s",s);
| ~~~~~^~~~~~~~
aliens.cpp: In function 'int main()':
aliens.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
16 | scanf("%lld%lld%lld",&n,&x,&y);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
284 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
2 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
2 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
208 KB |
Output is correct |
2 |
Correct |
2 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |