이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
multiset<ll> pq1;
pq1.insert(dp[0]-2*arr[0]);
vals1[0]=dp[0]-2*arr[0];
vals2[0] = 0;
for(int i = 1; i <= n; i++){
dp[i] = *(pq1.begin())+2*l;
ll cur = 0;
if(i-k>=0){
cur = dp[i-k];
}
dp[i] = min(dp[i],min(cur+2*arr[i-1],cur+l));
if(i!=n) {
vals1[i] = dp[i] - 2 * arr[i];
vals2[i] = dp[i];
pq1.insert(vals1[i]);
}
if(i-k>=0){
pq1.erase(pq1.find(vals1[i-k]));
}
}
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... |