# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
511472 | tabr | 선물상자 (IOI15_boxes) | C++17 | 675 ms | 213920 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif
long long delivery(int n, int k, int l, int p[]) {
vector<long long> dp1(n);
deque<pair<long long, int>> deq;
deq.emplace_front(0, -1);
for (int i = 0; i < n; i++) {
if (deq.front().second < i - k) {
deq.pop_front();
}
dp1[i] = deq.front().first + min(l, p[i] * 2);
while (!deq.empty() && deq.back().first >= dp1[i]) {
deq.pop_back();
}
deq.emplace_back(dp1[i], i);
}
deq.clear();
vector<long long> dp2(n);
deq.emplace_front(0, n);
for (int i = n - 1; i >= 0; i--) {
if (deq.front().second > i + k) {
deq.pop_front();
}
dp2[i] = deq.front().first + min(l, (l - p[i]) * 2);
# | 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... |