# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
254762 | model_code | Guess the number (BOI20_guess) | C++14 | 1 ms | 288 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;
int main()
{
int N;
scanf("%d", &N);
int L = 1;
int R = N;
while (L < R)
{
int mid = (L + R) / 2;
printf("? %d\n", mid);
fflush(stdout);
int fb;
scanf("%d", &fb);
if (fb == 0)
{
L = R = mid;
break;
}
else if (fb < 0)
{
L = mid + 1;
}
else
{
R = mid - 1;
}
}
printf("= %d\n", L);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |