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 dp[10000005];
long long dp2[10000005];
long long delivery(int n, int k, int l, int p[])
{
sort(p, p+n);
for(int i=1;i<=n;i++)
{
dp[i] = 2*p[i-1];
if(i>=k)
dp[i] += dp[i-k];
}
for(int i=n;i>=1;i--)
{
dp2[i] = 2*(l-p[i-1] +1);
if(i+k <= n)
dp2[i] += dp2[i+k];
}
long long ans=1e18;
for(int i=0;i<=n;i++)
ans=min(ans, dp[i]+dp2[i+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... |