Submission #403986

#TimeUsernameProblemLanguageResultExecution timeMemory
403986AntekbHotter Colder (IOI10_hottercolder)C++14
90 / 100
727 ms9060 KiB
#include "grader.h" #include<bits/stdc++.h> using namespace std; int HC(int N){ if(N==1)return 1; int l=1, r=N; int lst, akt; akt=(l+r+1)/2-1; Guess(akt); int x=1, y=3; while(l<r){ //cout<<lst<<" "<<akt<<" "<<l<<" "<<r<<"\n"; lst=akt; if(lst<l)akt=r-(r-l)*x/y; else if(lst>r)akt=l+(r-l)*x/y; else{ akt=l+r-lst; if(lst-l<(r-l)/4)akt-=(r-l)/4; if(r-lst<(r-l)/4)akt+=(r-l)/4; if(akt==lst){ if(akt==l)akt++; else akt--; } } /*akt=(l+r+1)/2; if(akt==lst)akt--;*/ int k=Guess(akt); //cout<<lst<<" "<<akt<<" "<<l<<" "<<r<<"\n"; if(k==0)return (lst+akt)>>1; if((akt<lst) ^ (k==1))l=max((lst+akt+2)/2, l); else r=min(r, (lst+akt-1)/2); } return l; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...