Submission #258735

#TimeUsernameProblemLanguageResultExecution timeMemory
258735sckmdColors (BOI20_colors)C++14
0 / 100
0 ms256 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; map <ll,bool> bio; int main() { int n; cin >> n; int mx = 62; ll ans = 0LL; cout << "? 1" << endl; bio[1]=true; ll lastask = 1; for(int i = mx; i >= 0; i--) { ll now = ans + (1LL<<i); if(lastask-now > 1 && !bio[lastask-now]) { cout << "? " << lastask-now << endl; int rez; cin >> rez; if(rez==1) { bio[lastask-now]=true; lastask -= now; continue; } else { bio[lastask-now]=true; ans += (1LL<<i); lastask -= now; continue; } } if(lastask+now <= n && !bio[lastask+now]) { cout << "? " << lastask+now << endl; int rez; cin >> rez; lastask += now; bio[lastask]=true; if(rez==0) { ans += (1LL<<i); } continue; } } cout << "= " << ans+1; 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...