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()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
int l=0,r=n+1;
while(1)
{
long int m=(r+l)/2,x;
cout<<"? "<<m<<endl;
cin>>x;
if(x==1)
{
r=m;
}
else if(x==0)
{
cout<<"= "<<m;
break;
}
else
{
l=m;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |