Submission #1131610

#TimeUsernameProblemLanguageResultExecution timeMemory
1131610alterioColors (BOI20_colors)C++20
0 / 100
0 ms416 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long #define all(x) (x).begin(), (x).end() int ask(int x) { cout << "? " << x << endl; int val; cin >> val; return val; } int main() { int n; cin >> n; int l = 0, r = n; int pos = (n + 1) / 2 - (n / 4) + (n % 2 == 0); ask(pos); unordered_set<int> used; while (l + 1 < r) { int mid = (l + r) / 2; if (pos + mid <= n && !used.count(pos + mid)) pos += mid; else pos -= mid; int x = ask(pos); if (x) r = mid; else l = mid; } cout << "= " << r << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...