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 "boxes.h"
#include <bits/stdc++.h>
using namespace std;
long long int typedef li;
li dp[10000007];
li dpr[10000007];
long long delivery(int n, int k, int L, int p[])
{
for (int i=1;i<=n;i++) dp[i]=dp[max(0,i-k)]+2*p[i-1];
for (int i=n;i>=1;i--) dpr[i]=dpr[min(n+1,i+k)]+2*(L-p[i-1]);
li ans=1e18;
for (int i=1;i<=n+1;i++) ans=min(ans,dp[i-1]+dpr[i]);
for (int i=k;i<=n+1;i++) ans=min(ans,dp[i-k]+dpr[i]+L);
return ans;
}
# | 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... |