# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
810205 | 2023-08-06T06:30:44 Z | ymm | Colors (BOI20_colors) | C++17 | 1 ms | 300 KB |
#include <bits/stdc++.h> typedef long long ll; using namespace std; set<ll> S; bool query(ll x) { assert(!S.count(x)); S.insert(x); int d; printf("? %lld\n", x+1); fflush(stdout); scanf("%d", &d); return d; } int main() { ll n; scanf("%lld", &n); ll pos = n/4; query(pos); ll l = 1, r = n; while (l < r) { ll m0 = (l+r)/2; ll x = pos < n/2? 1: -1; ll m; for (ll i = 0;; ++i) { ll dard = i%2? i/2+1: -i/2; if (S.count(pos + x*(m0+dard))) continue; m = m0+dard; break; } if (query(pos = pos + x*m)) r = m; else l = m+1; } printf("= %lld\n", l); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 292 KB | OK (4 queries) |
2 | Runtime error | 1 ms | 300 KB | Execution killed with signal 13 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 292 KB | OK (4 queries) |
2 | Runtime error | 1 ms | 300 KB | Execution killed with signal 13 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 292 KB | OK (4 queries) |
2 | Runtime error | 1 ms | 300 KB | Execution killed with signal 13 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 292 KB | OK (4 queries) |
2 | Runtime error | 1 ms | 300 KB | Execution killed with signal 13 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 292 KB | OK (4 queries) |
2 | Runtime error | 1 ms | 300 KB | Execution killed with signal 13 |
3 | Halted | 0 ms | 0 KB | - |