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 main()
{
int n,x,y;
cin>>n>>x>>y;
int st=y,en=n+1;
while (st+1<en)
{
int mid=(st+en)/2;
cout<<"examine "<<x<<' '<<mid<<endl;
string s;
cin>>s;
if (s=="true")
st=mid;
else
en=mid;
}
y=st;
st=x,en=n+1;
while (st+1<en)
{
int mid=(st+en)/2;
cout<<"examine "<<mid<<' '<<y<<endl;
string s;
cin>>s;
if (s=="true")
st=mid;
else
en=mid;
}
x=st;
st=1,en=y;
while (st+1<en)
{
int mid=(st+en)/2;
cout<<"examine "<<x<<' '<<mid<<endl;
string s;
cin>>s;
if (s=="false")
st=mid;
else
en=mid;
}
int m=y-st;
m=m/(m&(-m));
x-=m/2;
y-=m/2;
for (int i=1;i<=5;i++)
for (int j=1;j<=5;j++)
{
if (i%2!=j%2)
continue;
bool b=true;
// cout<<i<<' '<<j<<endl;
for (int k=1;k<=5 and b;k++)
if (k!=i)
{
int y1=y+(k-i)*m;
if (y1<1 or y1>n)
b=false;
else
{
cout<<"examine "<<x<<' '<<y1<<endl;
string s;
cin>>s;
cout.flush();
if (s=="false" and i%2==k%2)
b=false;
else if(s=="true" and i%2!=k%2)
b=false;
}
}
for (int k=1;k<=5 and b;k++)
if (k!=j)
{
int x1=x+(k-j)*m;
if (x1<1 or x1>n)
b=false;
else
{
cout<<"examine "<<x1<<' '<<y<<endl;
string s;
cin>>s;
cout.flush();
if (s=="false" and i%2==k%2)
b=false;
else if(s=="true" and i%2!=k%2)
b=false;
}
}
if (b)
{
cout<<"solution "<<x+(3-j)*m<<' '<<y+(3-i)*m<<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... |