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;
using ll = long long;
using ii = pair<ll,ll>;
long long delivery(int N, int K, int L, int p[]) {
if(K==1)
{
ll res = 0;
for(ll i=0;i<N;i++)
res += 2*min(p[i],L-p[i]);
return res;
}
else if(K==N)
{
ll res = L;
for(ll i=1;i<N;i++)
{
ll r = N-i;
res = min(res,(ll)p[i-1]*2 + ((ll)L-(ll)p[N-r-1])*2);
}
res = min(res,(ll)p[N-1]*2);
res = min(res,((ll)L-(ll)p[0])*2);
return res;
}
else return 0;
}
# | 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... |