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<algorithm>
using namespace std;
int count_clock[20000000],clock[20000000],pat;
long long delivery(int N, int K, int L, int p[]) {
for(int i=0;i<N;i++)
{
if(i<K)
clock[i]=2*p[i];
else
clock[i]=clock[i-K]+2*p[i];
}
pat=clock[N-1];
for(int i=N-1;i>=0;i--)
{
if(i+K>N-1)
count_clock[i]=2*(L-p[i]);
else
count_clock[i]=count_clock[i+K]+2*(L-p[i]);
}
pat=min(pat,count_clock[0]);
pat=count_clock[K]+L;
for(int i=0;i<N-K;i++)
pat=min(clock[i]+count_clock[i+K+1]+L,pat);
for(int i=0;i<N;i++)
pat=min(clock[i]+count_clock[i+1],pat);
return pat;
}
# | 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... |