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 <algorithm>
long long L[11111111];
long long R[11111111];
long long delivery(int n,int k,int l,int a[])
{
long long r=1e18;
int i;
for(i=1;i<=n;i++)
{
L[i]=std::min(a[i-1]<<1,l);
if(i>k)L[i]+=L[i-k];
}
for(i=n-1;i>=0;i--)
{
R[i]=std::min((l-a[i])<<1,l);
if(i+k<n)R[i]+=R[i+k];
}
for(i=0;i<=n;i++)r=std::min(r,L[i]+R[i]);
return r;
}
# | 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... |