#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
int HC(int N){
int b[2] = {1,N};
Guess(b[1]);
for(int w = 0, r; b[0] < b[1]; w ^= 1){
r = Guess(b[w]);
//printf("N = %d, [%d, %d], res = %d\n",N,b[w],b[!w],r);
if(!r) return (b[0] + b[1]) / 2;
if(r == -1){
if(b[1] - b[0] == 1) return b[!w];
Guess(b[!w]);
b[w] = (b[0] + b[1] + !w) / 2;
w = !w;
}
else{
if(b[1] - b[0] == 1) return b[w];
b[!w] = (b[0] + b[1] + w) / 2;
}
}
return b[0];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
1272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
1272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
1272 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
806 ms |
8288 KB |
Output isn't correct - alpha = 0.000000000000 |