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;
typedef long long ll;
ll delivery(int N_, int K_, int L_, int p[])
{
ll L = L_; ll N = N_; ll K = K_;
vector<ll> v(N);
for (int i = 0; i < N; i++)
v[i] = p[i];
if (K == 1)
{
ll res = 0;
for (int i = 0; i < N; i++)
res += min(v[i], L - v[i]) * 2;
return res;
}
sort(v.begin(), v.end());
ll res = min({L, v.back() * 2, (L - v.front()) * 2});
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... |