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;
int n,xo,yo;
bool check(int x,int y){
printf("examine %d %d",x,y);
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;
printf("solution %d %d",Xl+sz,Yr-sz);
}
| # | 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... |