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 "prize.h"
#include <bits/stdc++.h>
using namespace std;
int n;
int bin_search() {
int lo = 0, hi = n - 1;
while (lo != hi) {
int mid = (lo + hi / 2);
vector<int> res = ask(mid);
if (res[0] + res[1] == 0) return mid;
else if (res[0] == 1) hi = mid - 1;
else lo = mid + 1;
}
return lo;
}
int find_best(int tmp_n) {
n = tmp_n;
int ans = bin_search();
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |