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 i, n, k, l, ans=1e18, A[10000010], X[10000010], Y[10000010];
long long delivery(int N, int K, int L, int p[])
{
n=N;
k=K;
l=L;
for(i=0;i<n;i++)A[i]=p[i];
for(i=0;i<n;i++)
{
if(i>=k)X[i]=X[i-k]+2*A[i];
else X[i]=2*A[i];
}
for(i=n-1;i>=0;i--)
{
if(i>n-1-k)Y[i]=2*(l-A[i]);
else Y[i]=Y[i+k]+2*(l-A[i]);
}
for(i=0;i<n-1;i++)
{
ans=min(ans, X[i]+Y[i+1]);
}
return ans;
}
# | 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... |