이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <algorithm>
#include "grader.h"
#include <cassert>
#include <iostream>
#include <cmath>
using namespace std;
int ct;
int HC(int n){
int low,high,mid,g,prev,use;
ct = 0;
low = 1;
high = n;
use = 0;
prev = -1;
while(low < high){
mid = low + (high-low)/2;
if(!use){
prev = rand()%2 ? low : high;
use = 1;
Guess(prev);
}
g = Guess(prev^low^high);
g *= (prev == low ? 1 : -1);
prev = prev^low^high;
++ct;
if(!g){
assert(mid-low == high-mid);
return mid;
}
if(g > 0){
low = mid+1;
use = prev == high;
}else{
high = (low+high+1)/2-1;
use = prev == low;
}
}
return low;
}
# | 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... |