# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
288984 | user202729 | Boxes with souvenirs (IOI15_boxes) | C++17 | 771 ms | 73000 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// moreflags=grader.cpp
//
// 10
#include "boxes.h"
#include<vector>
#include<cstdint>
#include<climits>
#include<deque>
long long delivery(int N, int K, int L, int p[]) {
std::deque<std::pair<int, int64_t>> queue, queueAdd;
queue.push_back({N, 0});
queueAdd.push_back({N, 2*p[N-1]});
for(auto index=N;;){
--index;
int64_t curValue=INT64_MAX;
for(auto pointer: {&queue, &queueAdd}){
auto& it=*pointer;
while(it.back().first>index+K) it.pop_back();
}
curValue=std::min(curValue, queue.back().second+ std::min(L, 2* (L-p[index])));
curValue=std::min(curValue, queueAdd.back().second);
if(index==0) return curValue;
auto const add=[&](auto& queue, int64_t value){
while(not queue.empty() and queue.front().second>=value)
queue.pop_front();
queue.push_front({index, value});
};
add(queue, curValue);
add(queueAdd, curValue+2*p[index-1]);
}
}
Compilation message (stderr)
# | 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... |