# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
598809 | MilosMilutinovic | Guess the number (BOI20_guess) | C++14 | 1 ms | 316 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/**
* author: wxhtzdy
* created: 19.07.2022 07:53:20
**/
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
auto Ask = [&](int x) {
cout << "? " << x << endl;
cin >> x;
return x;
};
int low = 1, high = n;
while (low <= high) {
int mid = low + high >> 1;
int x = Ask(mid);
if (x == 0) {
cout << "= " << mid << endl;
return 0;
}
if (x == -1) {
low = mid + 1;
} else {
high = mid - 1;
}
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |