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 <bits/stdc++.h>
long long delivery(int N, int K, int L, int p[]);
using ll = long long;
ll inf = 1LL<<60LL;
long long delivery(int N, int K, int L, int p[]) {
ll dp[N+1];
for(auto&x:dp)x=inf;
dp[0]=0;
for(int i=0;i!=N;++i){
int c=0;
for(int j=i;j!=-1;--j){
++c;
dp[i+1]=std::min(dp[i+1],dp[j]+std::min({(ll)L,(ll)2*p[i],(ll)2*L-2*p[j]}));
if(c==K)break;
}
}
return dp[N];
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |