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;
const int N = 2e5 + 5;
int n;
vector <int> query_answer[N];
int cnt_left[N], cnt_right[N];
int type[N];
void query(int x){
if (not query_answer[x].empty()){
return;
}
query_answer[x] = ask(x);
cnt_left[x] = query_answer[x].front();
cnt_right[x] = query_answer[x].back();
type[x] = accumulate(query_answer[x].begin(), query_answer[x].end(), 0);
}
int find_best(int _n){
n = _n;
int lo = 1, hi = n;
while (lo < hi){
int mid = (lo + hi) >> 1;
query(mid);
if (type[mid] == 0){
return mid;
}
if (cnt_left[mid]){
hi = mid - 1;
}
else{
lo = mid + 1;
}
}
return lo;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |