이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
int n,xo,yo;
bool check(int x,int y){
cout << "examine " << x << " " << y << endl;
string ret;
cin >> ret;
return ret=="true";
}
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
cin >> n >> xo >> yo;
int l=xo,r=n;
for(int i=1;xo+i<=n;i<<=1){
if(!check(xo+i,yo)){
r=xo+i;
break;
}else{
l=xo+i;
}
}
while(r-1>l){
int m=(l+r)>>1;
if(check(m,yo)){
l=m;
}else{
r=m;
}
}
int xr=l;
l=1,r=xo;
for(int i=1;xo-i>=1;i<<=1){
if(!check(xo-i,yo)){
l=xo-i;
break;
}else{
r=xo-i;
}
}
while(r-1>l){
int m=(l+r)>>1;
if(check(m,yo)){
r=m;
}else{
l=m;
}
}
int xl=r;
int sz=xr-xl+1;
l=xr,r=n;
for(int i=2*sz;xr+i<=n;i<<=1){
if(!check(xr+i,yo)){
r=xr+i;
break;
}else{
l=xr+i;
}
}
while(r-sz>l){
int m=(l+r)>>1;
if(check(m,yo)){
l=m;
}else{
r=m;
}
}
int Xr=l;
l=1,r=xl;
for(int i=2*sz;xl-i>=1;i<<=1){
if(!check(xl-i,yo)){
l=xl-i;
break;
}else{
r=xl-i;
}
}
while(r-sz>l){
int m=(l+r)>>1;
if(check(m,yo)){
r=m;
}else{
l=m;
}
}
int Xl=r;
l=yo,r=n;
for(int i=2*sz;yo+i<=n;i<<=1){
if(!check(Xl,yo+i)){
r=yo+i;
break;
}else{
l=yo+i;
}
}
while(r-sz>l){
int m=(l+r)>>1;
if(check(Xl,m)){
l=m;
}else{
r=m;
}
}
while(r-1>l){
int m=(l+r)>>1;
if(check(Xl,m)){
l=m;
}else{
r=m;
}
}
int Yr=l;
sz=(Xr-Xl)/2;
cout << "solution " << Xl+sz << " " << Yr-sz << endl;
}
| # | 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... |