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 <bits/stdc++.h>
using namespace std;
int HC(int N){
int b[2] = {1,N};
Guess(b[1]);
for(int w = 0, r; b[0] < b[1]; w ^= 1){
r = Guess(b[w]);
//printf("N = %d, [%d, %d], res = %d\n",N,b[w],b[!w],r);
if(!r) return (b[0] + b[1]) / 2;
if(r == -1){
if(b[1] - b[0] == 1) return b[!w];
Guess(b[!w]);
b[w] = (b[0] + b[1] + !w) / 2;
w = !w;
}
else{
if(b[1] - b[0] == 1) return b[w];
b[!w] = (b[0] + b[1] + w) / 2;
}
}
return b[0];
}
# | 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... |