#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 |
1 |
Correct |
28 ms |
1400 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
1280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
1280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
846 ms |
24184 KB |
Output is partially correct - alpha = 0.120000000000 |