| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1119222 | Newtonabc | Boxes with souvenirs (IOI15_boxes) | C++14 | 2 ms | 2644 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.
#include "boxes.h"
#include<bits/stdc++.h>
using namespace std;
const int N=1e7+10;
long long dpa[N],dpb[N];
int n,k,l;
long long delivery(int N, int K, int L, int p[]) {
    n=N,k=K,l=L;
    for(int i=0;i<n;i++){
        int j=n-i-1;
        if(i-k>=0) dpa[i]=dpa[i-k]+2LL*(long long)p[i];
        else dpa[i]=2LL*(long long)p[i];
        if(j+k<n) dpb[j]=dpb[j+k]+2LL*(long long)(l-p[j]);
        else dpb[j]=2LL*(long long)(l-p[j]);
    }
    long long ans=min(dpa[n-1],dpb[0]);
    for(int i=0;i+k-1<n;i++){
        int j=i+k-1;
        ans=min(ans,(i-1>=0?dpa[i-1]:0LL)+l+(j+1<n?dpb[j+1]:0LL));
    }
    return ans;
}
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... | ||||
