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 <iostream>
using namespace std;
long long a[10000010], dp[10000010], dpp[10000010], minn = 1e18;
long long delivery(int n, int k, int l, int p[]) {
for (int i = 1; i <= n; i++) a[i] = p[i-1];
for (int i = 1; i <= n; i++) dp[i] = dp[max(0,i-k)]+a[i]*2;
for (int i = n; i >= 1; i--) dpp[i] = dpp[min(n+1,i+k)]+(l-a[i])*2;
for (int i = 0; i <= n; i++) minn = min(minn,dp[i]+dpp[i+1]);
for (int i = 0; i <= n-k; i++) minn = min(minn,dp[i]+dpp[i+k+1]+l);
return minn;
}
# | 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... |