# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
628370 | 2022-08-13T10:59:20 Z | abcvuitunggio | Hotter Colder (IOI10_hottercolder) | C++17 | 0 ms | 0 KB |
#include "grader.h" using namespace std; int HC(int N){ int cnt=1,l=1,r=N,kq=N,val; int last=N; val=Guess(N); while (l<r){ int mid=l+r-last; mid=max(mid,1); mid=min(mid,N); val=Guess(mid); cnt++; if (val==0){ kq=(mid+last)/2; break; } if (val==1){ if (last<mid) l=(last+mid+1)/2; else{ r=(last+mid-1)/2; kq=r; } last=mid; continue; } if (last<mid){ r=(last+mid-1)/2; kq=r; } else l=(last+mid+1)/2; last=mid; } return kq; }