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;
typedef long long ll;
ll delivery(int n, int k, int l, int p11[]) {
vector<ll> p(n);
for (int i = 0; i < n; i++) p[i] = p11[i];
ll sum = 0;
ll first = 0, last = k-1;
while (last < n-1) {
sum += min(p[first], l-p[first]) + min(p[last]-p[first], l-(p[last]-p[first])) + min(p[last], l-p[last]);
first += k; last += k;
}
last = n-1;
sum += min(p[first], l-p[first]) + p[last]-p[first] + min(p[last], l-p[last]);
return sum;
}
# | 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... |