#include<iostream>
using namespace std;
int cur,l,r,ans,xx,yy;
pair<int,int> edge1,edge2;
void findedge2(){
cout << "STARTING\n";
xx=edge1.first,yy=edge1.second;
cur=1;
int ans=1e9;
r=xx;
while(true){
xx-=cur;
if(xx<=1) xx=1;
cout << "examine " << xx << " " << yy << endl;
fflush(stdout);
string str; cin >> str;
if(str=="false"){
l=xx+1;
break;
}
else{
ans=xx;
r=xx;
if(xx<=1){
l=1;
r=1;
break;
}
}
//cout << "PROCESSING " << l << " " << r << endl;
cur*=2;
}
//cout << "PROCESSING " << l << " " << r << endl;
while(l<=r){
int mid=(l+r)>>1;
//cout << "examine " << mid << " " << yy << endl;
fflush(stdout);
string str; cin >> str;
if(str=="false"){
r=mid-1;
}
else{
ans=min(ans,mid);
l=mid+1;
}
}
edge2={ans,edge1.second};
}
signed main(){
int n,x,y; cin >> n >> x >> y;
xx=x,yy=y;
cur=1;
l=x;
while(true){
xx+=cur;
if(xx>=n) xx=n;
cout << "examine " << xx << " " << yy << endl;
fflush(stdout);
string str; cin >> str;
if(str=="false"){
r=xx-1;
break;
}
else{
l=xx;
if(xx>=n){
l=xx;
r=xx;
break;
}
}
cur*=2;
}
while(l<=r){
int mid=(l+r)>>1;
cout << "examine " << mid << " " << yy << endl;
fflush(stdout);
string str; cin >> str;
if(str=="false"){
r=mid-1;
}
else{
ans=mid;
l=mid+1;
}
}
edge1.first=ans;
xx=ans;
cur=1;
l=y;
while(true){
yy+=cur;
if(yy>=n) yy=n;
cout << "examine " << xx << " " << yy << endl;
fflush(stdout);
string str; cin >> str;
if(str=="false"){
r=yy-1;
break;
}
else{
l=yy;
if(yy>=n){
l=yy;
r=yy;
break;
}
}
cur*=2;
}
while(l<=r){
int mid=(l+r)>>1;
cout << "examine " << xx << " " << mid << endl;
fflush(stdout);
string str; cin >> str;
if(str=="false"){
r=mid-1;
}
else{
ans=mid;
l=mid+1;
}
}
edge1.second=ans;
findedge2();
int m=edge1.first-edge2.first+1;
xx=edge1.first;
yy=edge1.second;
ans=edge1.first;
while(true){
xx+=2*m;
if(xx>=n) xx=n;
cout << "examine " << xx << " " << yy << endl;
fflush(stdout);
string str; cin >> str;
if(str=="false"){
break;
}
else{
ans=xx;
if(xx==n){
break;
}
}
}
if(ans+m<=n && yy+m<=n){
cout << "examine " << ans+m << " " << yy+m << endl;
fflush(stdout);
string str; cin >> str;
if(str=="true"){
ans+=m;
}
}
int mx=ans;
xx=edge1.first;
yy=edge1.second;
ans=edge1.second;
while(true){
yy+=2*m;
if(yy>=n) yy=n;
cout << "examine " << xx << " " << yy << endl;
fflush(stdout);
string str; cin >> str;
if(str=="false"){
break;
}
else{
ans=yy;
if(yy==n){
break;
}
}
}
if(xx+m<=n && ans+m<=n){
cout << "examine " << xx+m << " " << ans+m << endl;
fflush(stdout);
string str; cin >> str;
if(str=="true"){
ans+=m;
}
}
int my=ans;
cout << "solution " << mx-2*m-(m/2) << " " << my-2*m-(m/2) << 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... |