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;
typedef long long ll;
#define F first
#define S second
long long delivery(int n, int K, int L, int p[]){
vector<pair<ll, ll>> v1, v2;
ll k=K, l=L;
ll a[n+2], a1[n+2];
a[0]=0;
for(int i=1; i<=n; i++){
if(i<k)a[i]=2*p[i-1];
else a[i]=2*p[i-1]+a[i-k];
}
a1[n+1]=0;
for(int i=n; i>0; i--){
if(i+k>n+1)a[i]=2*(l-p[i-1]);
else a[i]=2*(l-p[i-1])+a[i+k];
}
ll r=a[n];
for(int i=1; i+k<=n+1; i++){
r=min(r, a[i-1]+a1[i+k]+l);
}
return r;
}
# | 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... |