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>
#include "boxes.h"
using namespace std;
const int MAX = 1e7 + 10;
const long long INF = 1e18 + 7;
long long pre[MAX], suf[MAX];
long long delivery(int N, int K, int L, int p[]) {
for(int i = 0; i < N; i++) {
if(i - K >= 0) {
pre[i] += pre[i - K];
}
pre[i] += 2 * p[i];
}
for(int i = N - 1; i >= 0; i--) {
if(i + K < N) {
suf[i] += suf[i + K];
}
suf[i] += 2 * (L - p[i]);
}
long long ans = INF;
for(int i = 1; i < N; i++) {
ans = min(ans, pre[i - 1] + suf[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... |