Submission #873327

#TimeUsernameProblemLanguageResultExecution timeMemory
873327PagodePaivaColors (BOI20_colors)C++17
0 / 100
0 ms344 KiB
#include<bits/stdc++.h> using namespace std; bool query(int x){ int p; cout << "? " << 1 << '\n'; cout << flush; cin >> p; cout << "? " << x+1 << '\n'; cout << flush; int t; cin >> t; if(t == 1) return true; return false; } int main(){ int n; cin >> n; int l = 1, r = n; while(l < r){ if(r == l+1){ if(query(l)){ r = l; } else{ l = r; } break; } int mid = (l+r)/2; if(query(mid)){ r = mid; } else{ l = mid+1; } } cout << "= " << l << '\n'; }
#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...