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>
#define ll long long
using namespace std;
ll query(ll X){
cout<<"? "<<X<<endl;
ll res;
cin>>res;
return res;
}
int main(){
ll N;
cin>>N;
ll l=1, r=N;
bool found = false;
while(found == false){
ll m = (l+r)/2;
ll q = query(m);
if(q==1){
r=m-1;
}
else if(q==0){
found = true;
break;
}
else{
l=m+1;
}
}
cout<<"= "<<(l+r)/2<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |