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 <bits/stdc++.h>
using namespace std;
#include "boxes.h"
const int N = 10000001;
long long cw[N], ccw[N];
long long delivery(int n, int k, int l, int p[]) {
for (int i = 1; i <= n; ++i) {
cw[i] = 2 * p[i - 1] + (i - k < 0 ? 0 : cw[i - k]);
}
for (int i = n - 1; i >= 0; --i) {
ccw[i] = 2 * (l - p[i]) + (i + k > n ? 0 : ccw[i + k]);
}
long long ans = LLONG_MAX;
for (int i = 0; i <= n; ++i) {
ans = min({ans, cw[i] + ccw[min(n, i + k)] + l, cw[i] + ccw[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... |