This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*-----------------------------
Author : TgX.2
11Ti - K28 - CHV
-----------------------------*/
#ifndef TGX
#include "boxes.h"
#endif // !TGX
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e7 + 7;
long long b[maxn], c[maxn];
long long delivery(int n, int k, int l, int a[]) {
// sort(alln(a, n));
for(int i = 1; i <= n; i++) {
b[i] = min(l, a[i - 1] * 2);
if (i > k)
b[i] += b[i - k];
}
long long ans = b[n];
for(int i = n; i >= 1; i--) {
c[i] = min(l, (l - a[i - 1]) * 2);
if (i + k <= n)
c[i] += c[i + k];
ans = min(ans, b[i - 1] + c[i]);
}
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... |