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 l = 1, r = N, las;
int mid = (N + 1) / 2;
if (N == 1){
return 1;
}
else if (N == 2){
Guess(1);
int g = Guess(2);
if (g > 0){
return 2;
}
return 1;
}
int g = Guess(mid - 1);
las = mid - 1;
while (l != r){
mid = (l + r) / 2;
if (mid == las){
mid += 1;
}
g = Guess(mid);
if (g > 0){
if (las < mid){
if (l == mid){
l = mid + 1;
}
else{
l = mid;
}
}
else{
r = mid;
}
}
else if (g < 0){
if (las < mid){
r = mid;
}
else{
if (l == mid){
l = mid + 1;
}
else{
l = mid;
}
}
}
else{
return (mid + las) / 2;
}
las = mid;
}
return l;
}
# | 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... |