Submission #31191

#TimeUsernameProblemLanguageResultExecution timeMemory
31191pasa3232Boxes with souvenirs (IOI15_boxes)C++14
70 / 100
559 ms274320 KiB
#include<bits/stdc++.h> #include "boxes.h" using namespace std; typedef long long ll; ll n, k, l, data[10000010], lef[10000010], righ[10000010], ans; long long delivery(int N, int K, int L, int p[]) { n=N, k=K, l=L; for(int i=0; i<n; i++) data[i+1]=p[i]; for(ll i=1; i<=n; i++){ lef[i]=min(l, (data[i]*2)); if(i>k) lef[i]+=lef[i-k]; } for(ll i=n; i>0; i--){ righ[i]=min(l, (l-data[i])*2); righ[i]+=righ[i+k]; } ans=min(lef[n], righ[1]); for(ll i=1; i<n; i++) ans=min(ans, lef[i]+righ[i+1]); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...