# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
234694 | 2020-05-25T08:01:36 Z | Nodir_Bobiev | Hotter Colder (IOI10_hottercolder) | C++14 | 0 ms | 0 KB |
#include "grader.h" int solve( int l, int r, int prevRequest){ if( l == r ) return l; if( r - l == 1 ){ Guess(l); int res2 = Guess(r); if( res2 == 1) return r; return l; } int m = (l+r)>>1; if( m == prevRequest ) m --; int res1 = Guess(m); if( res1 == 0 ){ return (m+prevRequest)/2; } if( res1 == 1 ){ if( prevRequest < m ) return solve(max(l,(m+prevRequest)/2+1), r, m); else return solve(l, min(r, (m+prevRequest-1)/2), m); } if( prevRequest < m ){ return solve(l, (prevRequest+m-1)/2, m); }else{ return solve((prevRequest+m)/2+1, r, m); } } int HC(int N){ Guess(N); return solve(1, N, N); }