Submission #484709

#TimeUsernameProblemLanguageResultExecution timeMemory
484709ac2huColors (BOI20_colors)C++14
0 / 100
1 ms200 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long map<ll,bool> used; ll n; bool good(ll mid, ll &cur){ if(cur + mid <= n && !used[cur + mid]){ cur += mid; used[cur] = true; cout << "? " << cur << endl; bool a;cin >> a; return a; } else if(cur - mid > 0 && !used[cur - mid]){ cur -= mid; used[cur] = true; cout << "? " << cur << endl; bool a;cin >> a; return a; } cout << "= " << 1e9 << endl; return false; } signed main(){ cin >> n; ll cur = 0; good(1,cur); ll l = 1,r = n; while(l < r){ ll mid = (l + r)/2; if(good(mid,cur)){ r = mid; } else{ l = mid + 1; } } cout << "= "<< l << 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...