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;
long long zap(long long zn)
{
cout<<"? "<<zn<<endl;
cout.flush();
int rt;
cin>>rt;
return rt;
}
void ans(long long zn)
{
cout<<"= "<<zn<<endl;
cout.flush();
}
int main()
{
cin.tie(0);
ios_base::sync_with_stdio(0);
long long n;
cin>>n;
long long start=0,zr=0,l=1,r=n,o=-1;
while(l<r)
{
l=(l+r-1)/2;
zr+=o*l;
start=max(start,1ll-zr);
l++;
o*=-1;
}
zap(start);
l=1,r=n,o=-1;
while(l<r)
{
long long mid=(l+r-1)/2;
start+=mid*o;
if(zap(start))
{
r=mid;
}
else
{
l=mid+1;
}
}
ans(l);
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... |