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 <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 |
---|
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... |