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+1;j!=0;--j){
++c;
//std::cout<<"Custo "<<i<<" "<<j<<" "<<dp[j-1]+std::min({(ll)L,(ll)2*p[i],(ll)2*L-2*p[i]})<<"\n";
dp[i+1]=std::min(dp[i+1],dp[j-1]+std::min({(ll)L,(ll)2*p[i],(ll)2*L-2*p[j-1]}));
if(c==K)break;
}
// std::cout<<"Custo "<<dp[i+1]<<"\n";
}
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... |