Submission #1304096

#TimeUsernameProblemLanguageResultExecution timeMemory
1304096nathlol2Guess the number (BOI20_guess)C++20
100 / 100
1 ms400 KiB
#include <bits/stdc++.h>
using namespace std;

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);

    int n;
    cin >> n;
    int l = 1, r = n;
    while(l <= r){
        int md = (l + r) / 2;
        cout << "? " << md << endl;
        int t; cin >> t;
        if(t == -1){
            l = md + 1;
        }else if(t == 1){
            r = md - 1;
        }else{
            cout << "= " << md << endl;
            return 0;
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...