# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
331681 | Victor | Colors (BOI20_colors) | C++17 | 1 ms | 384 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()
{
ll low = 1, high, curr, next, n;
int response;
scanf("%lld", &n);
high = n;
curr = (n + 3) / 4;
printf("? %lld\n", curr);
fflush(NULL);
scanf("%d", &response);
while (low != high)
{
next = curr + (low + high) / 2;
if (next > n)
next = curr - (low + high) / 2;
printf("? %lld\n", next);
fflush(NULL);
scanf("%d", &response);
if (response)
high = abs(next - curr);
else
low = abs(next - curr) + 1;
curr = next;
}
printf("%lld\n", high);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |