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;
const long long inf = 1e18L + 20;
const int maxN = 1e7 + 20;
int A[maxN];
long long dp[maxN];
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] = inf;
for (int j = (i > K && i < N ? K : 1); j <= min(i, K); j++) {
dp[i] = min(dp[i], dp[i - j] + min(min(A[i] * 2, (L - A[i - j + 1]) * 2), L));
}
}
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... |