#include "boxes.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll delivery(int n, int k, int l, int p[]) {
vector<ll> dp(n,0);
for (ll i = 0; i<n; i++){
ll minval = -1;
for (ll j = max((i-k+1),0LL); j<=i; j++){
//from j to i inclusive.
ll val = min(min((l-p[j])*2,(p[j]+l-p[i])*2),min(l,p[i]*2));
if (j>=0){
val+=dp[j-1];
}
if (minval==-1||minval>val){
minval=val;
}
}
dp[i]=minval;
//cout<<dp[i]<<endl;
}
return dp[n-1];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
372 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |