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;
vector<vector<int>> M;
vector<int> que(int x){
if(M[x].size())return M[x];
return M[x] = ask(x);
}
int f(int l, int r){
int m = (l+r)/2;
vector<int> v = que(m);
if(v[0] == 0 && v[1] == 0)return m;
if(l == r)return -1;
if(v[1] > v[0]){
int x = f(m+1,r);
if(x != -1)return x;
}
return f(l,m-1);
}
int find_best(int n) {
M.resize(n);
return f(0,n-1);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |