Submission #64639

# Submission time Handle Problem Language Result Execution time Memory
64639 2018-08-05T08:58:48 Z Bodo171 Boxes with souvenirs (IOI15_boxes) C++14
0 / 100
42 ms 41336 KB
#include "boxes.h"
#include <deque>
#include <iostream>
using namespace std;
const int nmax=10*1000*1000+5;
deque<int> dq(nmax);
long long val[nmax],dp[nmax];
int i,poz;
long long delivery(int N, int K, int L, int p[]) {
    for(i=1;i<=N;i++)
    {
        poz=max(i-K,0);
        dp[i]=min(L+dp[poz],2*p[i-1]+dp[poz]);
        val[i]=dp[i-1]+2*(L-p[i-1]);
        if((!dq.empty())&&i-K>=dq.front())
            dq.pop_front();
        while((!dq.empty())&&val[i]<val[dq.back()])
            dq.pop_back();
        dq.push_back(i);
        if(!dq.empty())
            dp[i]=min(dp[i],val[dq.front()]);
    }
    return dp[N];
}
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 41308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 41 ms 41336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 42 ms 41244 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 41308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 41308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 41308 KB Output isn't correct
2 Halted 0 ms 0 KB -