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;
typedef long long ll;
mt19937 rng(1557);
int HC(int N){
int l = 1, r = N, p = -1;
while(l<r){
if (p!=l && p!=r){
if (rng()&1) p = l, Guess(l);
else p = r, Guess(r);
}
int ret;
if (p==l){
p = r, ret = Guess(r);
if (ret==0) return (l+r) / 2;
else if (ret==1) l = (l+r) / 2 + 1;
else r = (l+r-1) / 2;
}
else{
p = l, ret = Guess(l);
if (ret==0) return (l+r) / 2;
else if (ret==-1) l = (l+r) / 2 + 1;
else r = (l+r-1) / 2;
}
}
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... |