# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
331671 | Victor | Guess the number (BOI20_guess) | C++17 | 69 ms | 512 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.
#include <bits/stdc++.h>
using namespace std;
#define ii pair<int, int>
#define iii pair<int, ii>
#define vi vector<int>
#define vii vector<ii>
#define ll long long
#define INF 1000000000
int main()
{
int low = 1, high, response;
scanf("%d", &high);
do
{
int middle = (high + low) / 2;
printf("? %d\n", middle);
fflush(NULL);
scanf("%d", &response);
if (response > 0) high = middle - 1;
else if (response < 0) low = middle + 1;
} while (response);
printf("= %d\n", (high + low) / 2);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |