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