#include "boxes.h"
#include <bits/stdc++.h>
using namespace std;
long long delivery(int N, int K, int L, int p[]) {
vector<long long> dp1,dp2;
dp1.resize(N);
dp2.resize(N);
dp1[0] = 2ll*p[0];
for(int i = 1; i < N; i++){
dp1[i] = i >= K ? dp1[i-K] : 0ll;
dp1[i] += 2ll*(long long)p[i];
}
dp2[N-1] = 2ll*(long long)(L-p[N-1]);
for(int i = N-2; i >= 0; i--){
dp2[i] = i+K >= N ? 0ll : dp2[i+K];
dp2[i] += 2ll*(long long)(L-p[i]);
}
long long mn = 1e18;
for(int i = 0; i < N; i++){
for(int j = i+1; j < N; j++){
mn = min(mn,dp1[i] + dp2[j] + (long long)(j-i+K-2)/(long long)K*(long long)L);
}
}
return mn;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |