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