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;
typedef long long ll;
ll delivery(int n, int k, int L, int p[]) {
ll l[n + 1], r[n + 1];
l[0] = r[0] = 0;
for(int i = 1; i <= n; i++) {
l[i] = 2ll * p[i - 1] + (i - k >= 0 ? l[i - k] : 0);
r[i] = 2ll * (L - p[n - i]) + (i - k >= 0 ? r[i - k] : 0);
}
ll mn = 1e18;
for(int i = 0; i <= n; i++) {
mn = min(mn, l[i] + r[n - i]);
if(n - k - i >= 0)
mn = min(mn, l[i] + r[n - k - i] + L);
}
return mn;
}
# | 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... |