Submission #367684

#TimeUsernameProblemLanguageResultExecution timeMemory
367684aryan12Guess the number (BOI20_guess)C++17
100 / 100
1 ms512 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int l = 1, r = n; int mid; while(l <= r) { mid = (l + r) / 2; cout << "? " << mid << endl; int x; cin >> x; if(x == 0) { cout << "= " << mid << endl; break; } if(x == -1) { l = mid + 1; } else { r = mid - 1; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...