This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//K = N Assigning each person to a "half"
#include "boxes.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
long long delivery(int N, int K, int L, int p[]) {
if(K == N) {
ll obvious = L;
ll lef = 0;
ll rig = L;
for(int i = 0; i < N; i++) {
if(p[i] <= L/2) {
lef = max(lef, (ll)p[i]);
} else {
rig = min(rig, (ll)p[i]);
}
}
ll other = 2ll*lef + 2ll*(L-rig);
return min(obvious, other);
} else {
ll res = 0;
for(int i = 0; i < N; i++) {
res += 2ll * min(p[i], L-p[i]);
}
return res;
}
}
# | 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... |