제출 #531113

#제출 시각아이디문제언어결과실행 시간메모리
531113sliviu선물상자 (IOI15_boxes)C++17
100 / 100
452 ms196188 KiB
#include <bits/stdc++.h> #include <boxes.h> using namespace std; using ll = long long; ll delivery(int n, int k, int l, int a[]) { ll ans = LLONG_MAX; vector<ll> dpl(n + 2), dpr(n + 2); for (int i = 1; i <= n; ++i) dpl[i] = dpl[max(i - k, 0)] + 2 * a[i - 1]; for (int i = n; i; --i) dpr[i] = dpr[min(i + k, n + 1)] + 2 * (l - a[i - 1]); for (int i = 0; i <= n; ++i) ans = min(ans, dpl[i] + min(dpr[i + 1], dpr[min(n + 1, i + k + 1)] + l)); 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...