Submission #1149463

#TimeUsernameProblemLanguageResultExecution timeMemory
1149463maliza88Guess the number (BOI20_guess)C++20
0 / 100
0 ms320 KiB
/*
    Author: Matin Alizadeh - Maliza88
    They're one person :)
*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef string str;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define endl '\n'
#define YES "YES"
#define NO "NO"
#define NoSolution "No solution"

const ll MOD = 1e9 + 7;

int n;

void solve() {

    cin >> n;

    int R = n + 1, L = 0;
    
    for (; ; ) {
        int mid = (R + L) / 2, ask;
        cout << '?' << ' ' << mid << endl;
        cin >> ask;
        if (ask == 0) {
            cout << '=' << ' ' << mid << endl;
            return;
        }

        if (ask == 1) {
            L = mid;
            continue;
        }

        R = mid;
    }

}

int main() {
    IOS;


    solve();


    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...