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>
using namespace std;
using ll = long long;
const int N = 1e7+3;
ll dp[N];
ll rdp[N];
ll delivery(int n, int k, int l, int a[]) {
sort(a, a+n);
for(int i=1; i<= n; i++)dp[i]=dp[i-min(i, k)]+2*a[i-1];
for(int i=n; i>=1; i--)rdp[i]=rdp[i+min(n+1-i, k)]+2*(l-a[i-1]);
ll ans=min(rdp[1], dp[n]);
for(int i=2; i<=n; i++)ans=min(ans, dp[i]+rdp[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... |