이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |