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 a[1000000];
long long delivery(int N, int K, int L, int p[]) {
long long mid, i, ans=0;
for(mid=0;mid<N;mid++)
{
if(p[mid]>L/2)break;
}
for(i=0;i<mid;i++)
{
a[i]=p[i]*2;
if(i>=K)a[i]+=a[i-K];
}
for(i=N-1;i>=mid;i--)
{
a[i]=(L-p[i])*2;
if(N-i>K)a[i]+=a[i+K];
}
ans=a[mid]+a[mid-1];
for(i=max((long long)(0),mid-K);i<min((long long)N,mid);i++)
{
ans=min(ans, a[i]+a[i+K+1]+L);
}
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... |