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[]) {
vector<int> v;
for(int i = 0; i < N; i++){
v.emplace_back(min(p[i],L-p[i]));
}
sort(v.begin(),v.end());
long long cur = 0ll;
long long mn = 1e18;
for(int i = 0; i < N; i++){
mn = min(mn,cur + (long long)(N-i+K-1)/(long long)K*(long long)L);
cur += 2ll*v[i];
}
mn = min(mn,cur);
return mn;
}
# | 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... |