///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n;
bool query(ll x,ll y){
string s;
if(max(x,y)>n || min(x,y)<=0) return 0;
cout<<"examine "<<x<<' '<<y<<endl;
cin>>s;
return (s=="true");
}
void solve(){
ll m,o,p,q,x1,x2,y1,y2;
cin>>n>>p>>q;
for(o=1;o<2e9;o*=2)
if(!query(p+o,q))
break;
o/=2;
x2=p;
for(int i=o;i>0;i/=2)
if(query(x2+i,q)) x2+=i;
for(o=1;o<2e9;o*=2)
if(!query(p-o,q))
break;
o/=2;
x1=p;
for(int i=o;i>0;i/=2)
if(query(x1-i,q)) x1-=i;
p=(x1+x2)/2;
m=2*(x2-x1+1);
for(o=1;o<2e9;o*=2)
if(!query(p,q+o))
break;
o/=2;
y2=q;
for(int i=o;i>0;i/=2)
if(query(p,y2+i)) y2+=i;
for(o=1;o<2e9;o*=2)
if(!query(p,q-o))
break;
o/=2;
y1=q;
for(int i=o;i>0;i/=2){
if(query(p,y1-i))
y1-=i;
}
q=(y1+y2)/2;
for(x1=p-m;x1>0;x1-=m)
if(!query(x1,q))
break;
for(x2=p+m;x2<=n;x2+=m)
if(!query(x2,q))
break;
for(y1=q-m;y1>0;y1-=m)
if(!query(p,y1))
break;
for(y2=q+m;y2<=n;y2+=m)
if(!query(p,y2))
break;
cout<<"solution "<<(x1+x2)/2<<' '<<(y1+y2)/2<<endl;
}
int main(){
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
340 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 |
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 |
# |
결과 |
실행 시간 |
메모리 |
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 |
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 |
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 |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |