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<iostream>
using namespace std;typedef long long L;L delivery(int n,int k,int l,int p[]){L pref[n],suf[n];for(L i=0;i<n;i++){(i>=k)?pref[i]=pref[i-k]+min(p[i]*2,l):pref[i]=min(p[i]*2,l);L j=n-i-1;(n-j-1>=k)?suf[j]=min(l,2*(l-p[j]))+suf[j+k]:suf[j]=min(l,2*(l-p[j]));}L ans=min(suf[0],pref[n-1]);for(L i=1;i<n;i++)ans=min(ans,pref[i-1]+suf[i]);return ans;}
# | 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... |