Submission #502484

#TimeUsernameProblemLanguageResultExecution timeMemory
502484IOI_champion_in_1980Colors (BOI20_colors)C++14
100 / 100
3 ms344 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; ll a, b, c, d, e, n, m, l, r, mid, ind, pos; bool barla(long long k) { bool ret; cout<<"? "<<k<<endl; cin>>ret; return ret; } int main() { cin>>n; l=1; r=n; pos=-1; ind=pos; long long bir=1; while (l<r) { mid=(l+r-1)/2; ind=ind+(bir*mid); pos=min(pos, ind); l=mid+1; bir=bir*(-1); } pos=abs(pos); barla(pos); l=1; r=n; bir=1; bool hakyky=false; while (l<r) { mid=(l+r-1)/2; pos=pos+(bir*mid); hakyky=barla(pos); if (hakyky) r=mid; else l=mid+1; bir=bir*(-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...