Submission #1126804

#TimeUsernameProblemLanguageResultExecution timeMemory
1126804m0vlanGuess the number (BOI20_guess)C++20
0 / 100
0 ms436 KiB
/**
*  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;
    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;
            return;
        }
        else 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...