# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
7452 | 2014-08-06T16:53:10 Z | gs13068 | Hotter Colder (IOI10_hottercolder) | C++ | 823 ms | 8284 KB |
#include "grader.h" #include<algorithm> int HC(int N) { int t; int l,r,m,prev; l=1; r=N; do { if(l==r)return l; if(r-l<7) { Guess(l); if(r-l==1)m=Guess(r); for(t=l+2;t<=r;t+=t+1<r?2:1) { m=Guess(t); if(m==0)return t-1; if(m==-1)return t-(t-l+1)%2-1; } if(m>0)return r; if(m==0)return r-1; return t-2; } Guess(l); t=Guess(m=std::min(N,std::max((l+r+1)/2,7))); if(t==0)return (l+m)/2; if(t==-1)r=(l+m-1)/2; else l=(l+m)/2+1; }while(t==-1); while(l<r) { prev=m; m=l+r-prev; if(m==prev)m++; if(m>N)m=N; if(m==prev)m--; if(m<1)m=1; t=Guess(m); if(t==0)return (prev+m)/2; if(t*(m-prev)>0&&l<(prev+m)/2+1)l=(prev+m)/2+1; if(t*(prev-m)>0&&r>(prev+m-1)/2)r=(prev+m-1)/2; } return l; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 1272 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 35 ms | 1272 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 35 ms | 1272 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 823 ms | 8284 KB | Output is partially correct - alpha = 0.800000000000 |