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 <iostream>
using namespace std;
int HC(int n)
{
Guess(1);
int l = 1, r = n;
int last = 1;
while (l < r)
{
int ot = l;
if (2*last < (l + r)) ot = r;
int m = (last + ot);
int rs = Guess(ot);
// cerr << l << " " << r << " " << ot << " " << m << " " << last << "\n";
if (rs == 0) return m/2;
if ((rs == -1) ^ (ot > last))
{
l = m/2 + 1;
}
else
{
r = m/2 - 1 + (m % 2);
}
last = ot;
}
return l;
}
# | 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... |