#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 |
1 |
Correct |
23 ms |
1280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
1280 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
1280 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
744 ms |
8312 KB |
Output isn't correct - alpha = 0.000000000000 |