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 <bits/stdc++.h>
#include "boxes.h"
#define N 10005
#define ll long long
using namespace std;
ll p[N], s[N];
ll delivery(int n, int k, int l, int a[]) {
for(int i = 0; i < n; i++){
int ind = i;
while(ind >= 0){
p[i+1] += (2*a[ind]);
ind -= k;
}
}
for(int i = n-1; i >= 0; i--){
int ind = i;
while(ind < n){
s[i+1] += (2*(l-a[ind]+1));
ind += k;
}
}
ll ans = LLONG_MAX;
for(ll i = 0; i <= n; i++){
for(ll j = i + 1; j <= n+1; j++){
ans = min(ans,p[i] + s[j] + ((j-i-1+k-1)/k)*(l+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... |