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 ){
Guess( 1 );
int l = 1, r = n, prev = 1;
while( l < r ) {
int now = Guess( r );
if( now == 0 ) return ( r + prev ) / 2;
else if( now == 1 ) {
int mid = ( l + r ) / 2;
if( ( l + r ) % 2 ) mid++;
prev = r, l = mid;
}
else {
int mid = ( l + r ) / 2;
if( ( l + r ) % 2 == 0 ) mid--;
prev = l, r = 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... |