# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
592357 | ogibogi2004 | Hotter Colder (IOI10_hottercolder) | C++14 | 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 <bits/stdc++.h>
#include "grader.h"
using namespace std;
int HC(int N)
{
srand(69);
Guess(1);
int last=1,l=1,r=N;
while(l<r)
{
int mid=rand()%(r-l+1)+l;
string t=Guess(mid);
int l1=N+1,r1=0;
for(int j=l;j<=r;j++)
{
int dist1=abs(mid-j);
int dist2=abs(last-j);
if(t=="same"&&dist1==dist2)
{
l1=min(l1,j);
r1=max(r1,j);
}
if(t=="hotter"&&dist1<dist2)
{
l1=min(l1,j);
r1=max(r1,j);
}
if(t=="colder"&&dist1<dist2)
{
l1=min(l1,j);
r1=max(r1,j);
}
}
last=mid;
l=l1;r=r1;
}
return l;
}