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>
long long cost1[10000007];
long long cost2[10000007];
using namespace std;
long long delivery(int N, int K, int L, int p[]) {
for(int i = 0; i < K; i++) {
long long cur1 = 0, cur2 = 0;
for(int j = i; j < N; j+=K) {
cur1 += min(p[j]*2,L);
cur2 += min((L-p[N-1-j])*2,L);
cost1[j] = cur1;
cost2[N-1-j] = cur2;
}
}
long long ans = min(cost1[N - 1], cost2[0]);
for(int i = 0; i < N - 1; i++) {
ans = min(ans, cost1[i] + cost2[i+1]);
}
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... |