# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
701644 | US3RN4M3 | Colors (BOI20_colors) | C++17 | 1 ms | 300 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;
using ll = long long;
bool ask(ll pos) {
pos++;
cout << "? " << pos << endl;
bool res; cin >> res;
return res;
}
main() {
ll n; cin >> n;
bool parity = true;
ll lo = 1, hi = n;
ll pos = (n - 1) / 3;
ask(pos);
while(lo != hi) {
ll mid = (lo + hi - 1) / 2;
if(parity) {
pos += mid;
} else {
pos -= mid;
}
parity = !parity;
if(ask(pos)) {
hi = mid;
} else {
lo = mid + 1;
}
}
cout << "= " << lo << endl;
}
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... |