# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
7452 | gs13068 | Hotter Colder (IOI10_hottercolder) | C++98 | 823 ms | 8284 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 "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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |