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;
long long cw[10000002], ccw[10000002];
long long delivery(int N, int K, int L, int p[]) {
for(int i = 1; i <= N; i++){
if(i - K <= 0) cw[i] = (p[i - 1] * 1ll) << 1;
else cw[i] = cw[i - K] + ((p[i - 1] * 1ll) << 1);
}
for(int i = N; i > 0; i--){
if(i + K > N) ccw[i] = ((L - p[i - 1]) * 1ll) << 1;
else ccw[i] = ccw[i + K] + (((L - p[i - 1]) * 1ll) << 1);
}
long long ans = LLONG_MAX;
for(int i = 0; i <= N; i++) ans = min(ans, cw[i] + ccw[i + 1]);
for(int i = 0; i + K <= N; i++) ans = min(ans, cw[i] + ccw[i + K + 1] + (L * 1ll));
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... |