This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Online C++ compiler to run C++ program online
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
if(n==1){
cout<<"= "<<1<<endl;
return 0;
}
int low=0,high=n;
while(high-low>1){
int mid=(high+low)/2;
bool rec=0;
cout<<"? "<<1<<endl;
cin>>rec;
cout<<"? "<<1+mid<<endl;
cin>>rec;
if(rec)
high=mid;
else
low=mid;
}
cout<<"= "<<high<<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... |