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"
int HC(int N){
int low = 1;
int high = N;
int flag = 1;
int g = Guess(low);
while ( high - low > 1 ) {
if(flag) g = Guess(high);
else g = Guess(low);
if(g == 1 && flag) {
low = (low + high) / 2;
flag = 0;
} else if (g == -1 && flag) {
high = (low + high) / 2;
g = Guess(low);
flag = 1;
} else if (g == 1 && flag == 0) {
high = (low + high) / 2;
flag = 1;
} else if (g == -1 && flag == 0 ) {
low = (low + high) / 2;
g = Guess(high);
flag = 0;
} else {
return (low + high) / 2;
}
}
if(flag) g = Guess(high);
else g = Guess(low);
if(g == 1 && flag) {
return high;
} else if( g == -1 && flag) {
return low;
} else if (g == 1 && flag == 0) {
return low;
} else {
return high;
}
}
# | 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... |