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>
using namespace std;
long long delivery(int n, int k, int l, int p[]) {
if(k == 1) {
long long ans = 0;
for(int i = 0; i < n; i++) {
ans += min(p[i] * 2, (l - p[i]) * 2);
}
return ans;
}
if(k == n) {
long long ans = l;
for(int i = -1; i < n; i++) {
ans = min(ans, (long long)(i == 0 ? 0 : p[i] * 2) + (long long)(i == n - 1 ? 0 : (l - p[i + 1]) * 2));
}
return ans;
}
return 0;
}
# | 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... |