#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define ll long long
#define ld long double
#define mp make_pair
ll n,X0,Y0;
bool Ask(ll x,ll y){
if(x<=0||x>n||y<=0||y>n)return false;
printf("examine %lld %lld\n",x,y);
fflush(stdout);
string s;cin>>s;
return s=="true";
}
int main(){
scanf("%lld%lld%lld",&n,&X0,&Y0);
ll L,R,l,r,d;
L=Y0,R=Y0;
l=Y0,r=n;
while(l<=r){
ll mid=l+r>>1;
if(Ask(X0,mid))R=mid,l=mid+1;
else r=mid-1;
}
l=1,r=Y0;
while(l<=r){
ll mid=l+r>>1;
if(Ask(X0,mid))L=mid,r=mid-1;
else l=mid+1;
}
d=R-L+1;
if(!Ask(X0,L+d/5))d/=5;
else if(!Ask(X0,L+d/3))d/=3;
while(Ask(X0,L-2*d))L-=2*d;
while(Ask(X0,R+2*d))R+=2*d;
ll Y=L+R>>1;
L=X0,R=X0;
l=X0,r=n;
while(l<=r){
ll mid=l+r>>1;
if(Ask(mid,Y0))R=mid,l=mid+1;
else r=mid-1;
}
l=1,r=X0;
while(l<=r){
ll mid=l+r>>1;
if(Ask(mid,Y0))L=mid,r=mid-1;
else l=mid+1;
}
d=R-L+1;
if(!Ask(L+d/5,Y0))d/=5;
else if(!Ask(L+d/3,Y0))d/=3;
while(Ask(L-2*d,Y0))L-=2*d;
while(Ask(R+2*d,Y0))R+=2*d;
ll X=L+R>>1;
printf("solution %lld %lld\n",X,Y);
fflush(stdout);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
aliens.cpp: In function 'int main()':
aliens.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
18 | scanf("%lld%lld%lld",&n,&X0,&Y0);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |