# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1054870 | Unforgettablepl | The Big Prize (IOI17_prize) | C++17 | 51 ms | 5544 KiB |
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 find_best(int n){
vector<vector<int>> memo(n);
auto askm = [&](int x) {
if(!memo[x].empty())return memo[x];
return memo[x]=ask(x);
};
int worst_case = 0;
for(int i=0;i<480;i++) {
auto curr = askm(i);
int c = curr[0]+curr[1];
if(c==0)return i;
worst_case = max(worst_case,c);
}
for(int i=480;i<n;i++) {
auto base = askm(i);
if(base[0]+base[1]==worst_case)
for(int jump=131072;jump;jump/=2) {
if(i+jump>=n)continue;
auto temp = askm(i+jump);
if(temp==base)i+=jump;
}
int curr = base[0]+base[1];
if(curr==0)return i;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |