#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
int HC(int n){
int res = 1, last = 0, taken = 0;
for(int step = 1 << 8; step > 2; step >>= 1) {
if(res + step <= n) {
Guess(res + step - 2);
int cur = Guess(res + step);
if(cur == 1) {
res += step;
taken = step;
}
else if(cur == 0) {
return res + step - 1;
}
last = step;
}
}
if(res == n) {
return n;
}
if(res == n - 1) {
Guess(res);
if(Guess(res + 1) == 1) return res + 1;
return res;
}
if(last == 0) {
Guess(res);
}
int a, b;
if(res == n - 2 || last != taken) {
Guess(res);
a = Guess(res + 2);
if(a == 0) return res + 1;
if(a == 1) return res + 2;
return res;
}
a = Guess(res + 1);
b = Guess(res + 3);
//cerr << a << " " << b << "\n";
if(b == 0) return res + 2;
if(a == -1) return res;
if(a == 1 && b == -1) return res + 1;
return res + 3;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
1272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
1272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
687 ms |
124092 KB |
Output isn't correct - alpha = 0.000000000000 |