#include <bits/stdc++.h>
using namespace std;
bool ask(long long x,long long y){
cout<<"examine "<<x<<" "<<y<<endl;
fflush(stdout);
string s;
cin>>s;
if(s == "true") return true;
return false;
}
int main(){
long long n,x0,y0;
cin>>n>>x0>>y0;
long long jmp = 1;
long long l,r,up,down;
while(1){
if(x0+jmp<=n){
if(ask(x0+jmp,y0)){
jmp*=2;
continue;
}
break;
}
else break;
}
long long x0_right = x0+jmp;
long long lo = x0;
long long hi = x0_right;
r = x0;
while(lo<=hi){
long long mid = (lo+hi)/2;
if(ask(mid,y0)){
r = mid;
lo = mid+1;
}
else hi = mid-1;
}
jmp = 1;
while(1){
if(x0-jmp>=1){
if(ask(x0-jmp,y0)){
jmp*=2;
continue;
}
break;
}
else break;
}
long long x0_left = x0-jmp;
lo = x0_left;
hi = x0;
l = x0;
while(lo<=hi){
long long mid = (lo+hi)/2;
if(ask(mid,y0)){
l = mid;
hi = mid-1;
}
else lo = mid+1;
}
jmp = 1;
while(1){
if(y0+jmp<=n){
if(ask(x0,y0+jmp)){
jmp*=2;
continue;
}
break;
}
else break;
}
long long y0_up = y0+jmp;
lo = y0;
hi = y0_up;
up = y0;
while(lo<=hi){
long long mid = (lo+hi)/2;
if(ask(x0,mid)){
up = mid;
lo = mid+1;
}
else hi = mid-1;
}
jmp = 1;
while(1){
if(y0-jmp>=1){
if(ask(x0,y0-jmp)){
jmp*=2;
continue;
}
break;
}
else break;
}
long long y0_down = y0-jmp;
lo = y0_down;
hi = y0;
down = y0;
while(lo<=hi){
long long mid = (lo+hi)/2;
if(ask(x0,mid)){
hi = mid-1;
down = mid;
}
else{
lo = mid+1;
}
}
long long mx = (l+r)/2;
long long my = (up+down)/2;
long long M = r-l+1;
long long aj = 0;
if(mx+2*M<=n){ if(ask(mx+2*M,my)) aj++;}
if(mx+4*M<=n){ if(ask(mx+4*M,my)) aj++;}
long long dzax = 0;
if(mx-2*M>=1){ if(ask(mx-2*M,my)) dzax++;}
if(mx-4*M>=1){ if(ask(mx-4*M,my)) dzax++;}
long long rig = mx+2*aj*M;
long long lif = mx-2*dzax*M;
long long ansx = (lif+rig)/2;
long long verev = 0;
if(my+2*M<=n){ if(ask(mx,my+2*M)) verev++;}
if(my+4*M<=n){ if(ask(mx,my+4*M)) verev++;}
long long nerq = 0;
if(my-2*M>=1){ if(ask(mx,my-2*M)) nerq++;}
if(my-4*M>=1){ if(ask(mx,my-4*M)) nerq++;}
long long u = my+2*verev*M;
long long dow = my-2*nerq*M;
long long ansy = (u+dow)/2;
cout<<"solution "<<ansx<<" "<<ansy<<endl;
fflush(stdout);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
324 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
324 KB |
Output is correct |
2 |
Correct |
2 ms |
324 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
324 KB |
Output is correct |
2 |
Correct |
3 ms |
528 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
528 KB |
Output is correct |
2 |
Correct |
2 ms |
528 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
528 KB |
Output is correct |
2 |
Correct |
2 ms |
528 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
528 KB |
Output is correct |
2 |
Correct |
3 ms |
528 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
528 KB |
Output is correct |
2 |
Correct |
3 ms |
536 KB |
Output is correct |
3 |
Correct |
3 ms |
544 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
568 KB |
Output is correct |
2 |
Correct |
3 ms |
568 KB |
Output is correct |
3 |
Correct |
3 ms |
568 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
568 KB |
Output is correct |
2 |
Correct |
4 ms |
568 KB |
Output is correct |
3 |
Correct |
2 ms |
568 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
568 KB |
Output is correct |
2 |
Correct |
3 ms |
572 KB |
Output is correct |
3 |
Correct |
4 ms |
572 KB |
Output is correct |