/**
* author: Movlan
**/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vl __int128
//#define int long long
#define sp " "
#define sn "\n"
#define pb push_back
#define ld long double
#define pf push_front
#define rb pop_back
#define rf pop_front
typedef pair<int,int> pii;
#define vi vector<int>;
#define vpii vector<pair<int,int>>
#define all(x) x.begin(),x.end()
#define input(x) freopen(x,"r",stdin)
#define output(x) freopen(x,"w",stdout)
#define IO ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
const int MAXN=3e5+7;
const int MOD=1e9+7;
int ask(int p) {
cout<<"? "<<p<<endl;
int res;
cout.flush();
cin>>res;
return res;
}
void solve(){
int n;
cin>>n;
int l=1,r=n;
while (l<=r) {
int mid=(l+r)>>1;
int res=ask(mid);
if (res==0) {
cout<<"= "<<mid;
cout.flush();
return;
}
if (res==1) {
r=mid-1;
}
else {
l=mid+1;
}
}
}
signed main() {
IO;
//input("in.txt");
//output("out.txt");
int t = 1;
// cin>>t;
while(t--){
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |