제출 #954395

#제출 시각아이디문제언어결과실행 시간메모리
954395emad234선물상자 (IOI15_boxes)C++17
20 / 100
2 ms2504 KiB
#include "boxes.h" #include <bits/stdc++.h> #define ll long long #define F first #define S second #define pii pair<ll, ll> const ll mod = 1e9 + 7; const ll mxN = 1e7 + 5; using namespace std; ll dpL[mxN], dpR[mxN]; long long delivery(int N, int K, int L, int p[]) { ll ans = 1e18; ll num = 0; ll k = K; for (int i = 0; i < N; i++) { if (!k) { num = dpL[i - 1]; k = K; } dpL[i] = num + min(2 * p[i], L); k--; // cout << dpL[i] << ' '; } // cout << '\n'; ans = dpL[N - 1]; num = 0; k = K; for (int i = N - 1; i >= 0; i--) { if (!k) { num = dpR[i + 1]; k = K; } dpR[i] = num + min((L - p[i]) * 2, L); k--; // cout << dpR[i] << ' '; if (i) ans = min(ans, dpR[i] + dpL[i - 1]); else ans = min(ans, dpR[i]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...