Submission #498836

#TimeUsernameProblemLanguageResultExecution timeMemory
498836devomega07Colors (BOI20_colors)C++14
0 / 100
0 ms200 KiB
#include "bits/stdc++.h" #define all(x) x.begin(),x.end() using namespace std; typedef long long l; void output(int num){ cout << "? " << num << endl; return; } void input(bool &ok){ int num; cin >> num; ok = bool(num); return; } int main() { int n, num; cin >> n; int high=n, low=1, llast=INT_MIN; cout << "? 0" << endl; cin >> num; while(low<=high){ int mid = (high+low)>>1; output(mid); bool ok; input(ok); if(high==low&&!ok) {cout << "= " << llast << endl; return 0;} else if(high==low&&ok){cout << "= " << mid << endl; return 0;} if(ok) high = mid-1; else low = mid+1; if(ok) llast = mid; } 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...