#include "boxes.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll delivery(int N, int K, int L, int positions[]) {
ll total = 0;
vector<int> right, left;
for (int i = 0; i < N; i++) {
int pos = positions[i];
if (pos == 0) continue;
if (pos <= L - pos)
right.push_back(pos);
else
left.push_back(L - pos);
}
sort(right.begin(), right.end(), greater<int>());
sort(left.begin(), left.end(), greater<int>());
for (int i = 0; i < (int)right.size(); i += K)
total += 2LL * right[i];
for (int i = 0; i < (int)left.size(); i += K)
total += 2LL * left[i];
return total;
}
# | 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... |