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 all(x) x.begin(),x.end()
using namespace std;
typedef long long l;
typedef struct query{
int q, ans;
} query;
//flex
ostream &operator<<(ostream &stream, query &obj){
cout << "? " << obj.q << endl;
cin >> obj.ans;
return stream;
}
//end of flexing..
int main()
{
int n; cin >> n;
int num; cout << "? 1" << endl; cin >> num;
int L=1, R=n;
query mid; mid.q = (L+R)>>1;
while(L<=R){
cout << mid;
if(mid.ans){
R=mid.q;
}
else{
L=mid.q+1;
}
if(L==R){ cout << "= " << L << endl; return 0; }
mid.q = (L+R)>>1;
}
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... |