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"
#define ll long long
#include <bits/stdc++.h>
using namespace std;
ll delivery(int N, int K, int L, int p[]) {
if(K == 1) {
ll ans = 0;
for(int i = 0; i < N; i++) {
ans += min(p[i], L - p[i]);
}
return ans;
}
ll ans = L;
sort(p, p + N);
for(int i = 0; i < N - 1; i++) {
ans = min(ans, (long long) 2 * p[i] + 2 * (L - p[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... |