This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
// x0 y0;
int n,xo,yo;
int xr,xl,yr,yl;
int main(){
cin >> n >> xo >> yo;
int l,r;
l = xo, r = n+1;
for(int i = 0; xo + (1<<i) <= n; ++i){
cout << "examine " << xo + (1<<i) << " " << yo << endl;
string ans; cin >> ans;
if(ans == "false"){
r = xo + (1<<i);
break;
}
}
while(r-l > 1){
int md = (l+r)>>1;
cout << "examine " << md << " " << yo << endl;
string ans; cin >> ans;
if(ans == "false")
r = md;
else
l = md;
}
xr = l;
l = xo, r = 0;
for(int i = 0; xo - (1<<i) >= 1; ++i){
cout << "examine " << xo - (1<<i) << " " << yo << endl;
string ans; cin >> ans;
if(ans == "false"){
r = xo - (1<<i);
break;
}
}
while(l-r > 2){
int md = (l+r)>>1;
cout << "examine " << md << " " << yo << endl;
string ans; cin >> ans;
if(ans == "false")
r = md;
else
l = md;
}
xl = l;
l = yo, r = n+1;
for(int i = 0; yo + (1<<i) <= n; ++i){
cout << "examine " << xo << " " << yo + (1<<i) << endl;
string ans; cin >> ans;
if(ans == "false"){
r = yo + (1<<i);
break;
}
}
while(r-l > 1){
int md = (l+r)>>1;
cout << "examine " << xo << " " << md << endl;
string ans; cin >> ans;
if(ans == "false")
r = md;
else
l = md;
}
yr = l;
// yr-yl = xr-xl
yl = xl-xr+yr;
int xc = (xl+xr)>>1, yc = (yl+yr)>>1, m = (xr-xl+1)<<1;
bool le = 0,ri = 0;
if(xc-m >= 1){
cout << "examine " << xc-m << " " << yc << endl;
string ans; cin >> ans;
if(ans == "true")
le = 1;
}
if(xc+m <= n){
cout << "examine " << xc+m << " " << yc << endl;
string ans; cin >> ans;
if(ans == "true")
ri = 1;
}
if(!le and ri)
xc += m;
if(le and !ri)
xc -= m;
bool up = 0,dw = 0;
if(yc-m >= 1){
cout << "examine " << xc << " " << yc-m << endl;
string ans; cin >> ans;
if(ans == "true")
dw = 1;
}
if(yc+m <= n){
cout << "examine " << xc << " " << yc+m << endl;
string ans; cin >> ans;
if(ans == "true")
up = 1;
}
if(dw and !up)
yc -= m;
if(!dw and up)
yc += m;
cout << "solution " << xc << " " << yc << endl;
return 0;
}
# | 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... |