#include "grader.h"
#include <cstdlib>
#include <ctime>
int HC(int N){
srand(time(NULL));
int lo = 1;
int hi = N;
int last = -1;
while(lo < hi){
if(last == lo){
int r = Guess(hi);
last = hi;
if(r > 0){
lo = (lo + hi) / 2 + 1;
}else{
hi = (lo + hi) / 2;
}
}else if(last == hi){
int r = Guess(lo);
last = lo;
if(r < 0){
lo = (lo + hi) / 2 + 1;
}else{
hi = (lo + hi) / 2;
}
}else{
if(rand() % 2){
last = lo;
Guess(lo);
}else{
last = hi;
Guess(hi);
}
}
}
return lo;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
241 ms |
1272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
241 ms |
1272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
246 ms |
1432 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2557 ms |
8440 KB |
Output isn't correct - alpha = 0.000000000000 |