제출 #685824

#제출 시각아이디문제언어결과실행 시간메모리
685824null_aweGuess the number (BOI20_guess)C++14
0 / 100
0 ms208 KiB
#include <iostream> using namespace std; int qry(int x) { cout << "? " << x << endl; int ans; cin >> ans; return ans; } int main() { int n; cin >> n; int lo = 0, hi = n + 1; while (lo < hi - 1) { int mid = (lo + hi) >> 1; int ans = qry(mid); if (ans < 0) hi = mid; else lo = mid; if (!ans) break; } cout << "= " << lo << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...