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 <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
using namespace std;
#define pb push_back
#define INF INT32_MAX
#define vt vector
typedef vt<int> vi;
typedef pair<int,int> pii;
typedef tuple<int,int,int> tiii;
typedef long long ll;
#define MOD 1000000007
ll delivery(int n, int k, int l, int arr[]){
vt<ll> vals1(n+1);
vt<ll> vals2(n+1);
vt<ll> dp(n+1);
dp[0] = 0;
for(int i = 1; i <= n; i++){
ll cur1 = 0;
ll cur2 = 0;
if(i-k>=0){
cur1 = dp[i-k];
cur2 = dp[i-k]-2*arr[i-k];
}
dp[i] = cur2+2*l;
dp[i] = min(dp[i],min(cur1+2*arr[i-1],cur1+l));
}
return dp[n];
}
# | 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... |