#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,x,y,m,a;
int ask(int i, int j){
if (min(i,j)<1||max(i,j)>n)
return 0;
cout << "examine " << i << ' ' << j << endl;
string s;
cin >> s;
return (s=="true");
}
int f(int x, int y, int dx, int dy, int lim=2000000000){
int l=1,r=lim,kq=0;
while (l<=r){
int mid=(l+r)>>1;
if (ask(x+mid*dx,y+mid*dy)){
kq=mid;
l=mid+1;
}
else
r=mid-1;
}
return kq;
}
int32_t main(){
cin >> n >> x >> y;
y+=f(x,y,0,1);
a=f(x,y,0,-1)+1;
if (a%5==0&&!ask(x,y-a/5))
m=a/5;
else if (a%3==0&&!ask(x,y-a/3))
m=a/3;
else
m=a;
x+=f(x,y,1,0)-m/2;
y-=m/2;
int b=f(x,y,m*2,m*2,5)-f(x,y,-m*2,-m*2,5),c=f(x,y,m*2,-m*2,5)-f(x,y,-m*2,m*2,5);
cout << "solution " << x+(b+c)*m << ' ' << y+(b-c)*m;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
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 |
# |
결과 |
실행 시간 |
메모리 |
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 |
596 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 |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 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 |
# |
결과 |
실행 시간 |
메모리 |
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 |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |