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;
//#define int long long
#define ll long long
#define xx first
#define yy second
#define all (x) begin(x), end(x)
#define FOR (i, a, b) for (auto i = (a); i < (b); ++ i)
const int NMAX = 1e7;
int ans[11111111], rez[11111111];
int delivery (int n, int k, int l, int s[]){
for (int i = 1; i <= n; ++ i){
ans[i] = min (s[i - 1] << 1 , l);
if (i > k){
ans[i] += ans[i - k];
}
}
int mini = ans[n];
for (int i = n - 1; i >= 0; -- i){
rez[i] = min ((l - s[i]) << 1, l);
if (i + k < n){
rez[i] += rez[i + k];
}
mini = min (mini, rez[i] + ans[i]);
}
return mini;
}
# | 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... |