# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
64242 | gnoor | Hotter Colder (IOI10_hottercolder) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "hottercolder.h"
int HC(int N){
//int g = Guess(1);
int lo=1;
int hi=N;
int lmid;
int rmid;
int res;
while (lo<hi) {
lmid=lo+(hi-lo)/3;
rmid=hi-(hi-lo)/3;
Guess(lmid);
res=Guess(rmid);
if (res==0) return (lmid+rmid)>>1;
if (res<0) {
//lmid side
hi=((lmid+rmid)>>1)-((rmid-lmid+1)%2);
} else {
//rmid side
lo=((lmid+rmid)>>1)+1;
}
}
return lo;
}