# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
54461 | MoNsTeR_CuBe | Boxes with souvenirs (IOI15_boxes) | C++17 | 0 ms | 0 KiB |
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;
#define int long long
#define INF 9223372036854775807
vector<int> DP;
int cost(int a, int b, int c){
int ans = c;
ans = min(ans, (c-(a-1))*2);
ans = min(ans, b);
return ans;
}
int f(int n, int l, int k){
int ans = INF;
for(int i = 1; i < k; i++){
DP[n] = min(ans, f(n-i, l, k)+cost(n-i,n,l));
}
return ans;
}
long long delivery(int N, int K, int L, int p[]) {
return f(N,L,K);
}
/*
signed main(){
int N, K, L;
cin >> N >> K >> L;
int tab[N];
DP.resize(N);
for(int i = 0; i < N; i++){
cin >> tab[i];
}
#undef int long long
cout << delivery(N,K,L,tab) << endl;
}
*/