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;
#define ll long long
ll delivery(int n, int k, int l, int p[]){
ll cw[n], ccw[n];
cw[0] = p[0] * 2; ccw[n - 1] = (l - p[n - 1]) * 2;
for (int i = 1; i < n; i++){
cw[i] = cw[max(0, i - k)] + p[i]
+ min(p[i], l - p[i]);
}
for (int i = n - 2; i >= 0; i--){
ccw[i] = ccw[min(n - 1, i + k)] + (l - p[i])
+ min(p[i], l - p[i]);
}
ll re = min(cw[n - 1], ccw[0]);
for (int i = 1; i < n; i++){
re = min(re, cw[i - 1] + ccw[i]);
}
return re;
}
# | 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... |