# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
854225 | 2023-09-26T11:54:10 Z | Trisanu_Das | Colors (BOI20_colors) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; #define int long long bool query(int i) { cout << "? " << i << '\n'; cin >> i; return i; } int main() { int N; cin >> N; int i = 0, l = 1, r = N, d = -1; for(; l < r; d = -d) { l = (l + r - 1) >> 1; i = max(i, int(1) - (c += d * l++)); } query(i); l = 1, r = N, d = -1; for(; l < r; d = -d) { int m = (l + r - 1) >> 1; if(query(i += d * m)) r = m; else l = m + 1; } cout << "= " << l << '\n'; }