Submission #392904

#TimeUsernameProblemLanguageResultExecution timeMemory
392904wind_reaperColors (BOI20_colors)C++17
0 / 100
1 ms200 KiB
#include <bits/stdc++.h> using namespace std; int Ask(int64_t num){ cout << "? " << num << endl; int x; cin >> x; return x; } int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int64_t n; cin >> n; int64_t l = 1, r = n-1, start = n, cur = 0, dir = 1; while(l <= r){ int64_t mid = (l + r) >> 1; cur += dir*mid; dir *= -1; start = min(start, n - cur); l = mid + 1; } l = 1, r = n-1, dir = 1; int64_t answer = n-1; Ask(start); while(l <= r){ int64_t mid = (l + r) >> 1; int64_t ask = start + dir*mid; dir *= -1; if(Ask(ask)){ answer = mid; r = mid - 1; } else l = mid + 1; start = ask; } cout << "= " << answer << '\n'; return 0; }
#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...