Submission #502447

#TimeUsernameProblemLanguageResultExecution timeMemory
502447srivatsav_kannanColors (BOI20_colors)C++14
0 / 100
1 ms200 KiB
#include <iostream> #include <fstream> #include <vector> #include <set> #include <queue> #include <cmath> #include <map> #include <algorithm> #include <unordered_map> using namespace std; #define int long long int signed main() { int n; cin >> n; int l = 1, r = n; int prev = 1; cout << "? 1" << endl; int cur; cin >> cur; while (l < r){ int mid = (l+r)/2; if (l == r-1) mid = r; cout << "? " << prev+mid << endl; cin >> cur; prev += mid; if (cur){ if (l == r){ cout << "= " << l << endl; break; } if (l == r-1){ cout << "= " << r << endl; break; } l = mid; } else { r = mid-1; if (l == r-1){ cout << "= " << l << endl; break; } } } 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...