# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
810533 | ymm | Colors (BOI20_colors) | C++17 | 1 ms | 336 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>
typedef long long ll;
using namespace std;
set<ll> S;
ll n;
bool query(ll x)
{
assert(0 <= x && x < n && !S.count(x));
S.insert(x);
int d;
printf("? %lld\n", x+1);
fflush(stdout);
scanf("%d", &d);
return d;
}
int main()
{
scanf("%lld", &n);
query(0);
ll ans = 1;
ll pos = 0;
for (int i = 0; i < n-1; ++i) {
ll pos2 = i%2? n-pos: n-1-pos;
if (!query(pos2)) {
ans = abs(pos-pos2)+1;
break;
}
pos = pos2;
}
printf("= %lld\n", ans);
}
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... |