Submission #594638

#TimeUsernameProblemLanguageResultExecution timeMemory
594638VanillaBoxes with souvenirs (IOI15_boxes)C++17
100 / 100
472 ms195992 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std;const int q=1e7+2;int64_t l[q],r[q];long long delivery(int n,int k,int m,int p[]){for(int i=1;i<=n;i++){l[i]=l[max(0,i-k)]+min(p[i-1]*2,m);}reverse(p,p+n);for(int i=1;i<=n;i++){r[i]=r[max(0,i-k)]+min((m-p[i-1])*2,m);}int64_t rs=1e18;for(int i=0;i<=n;i++){rs=min(rs,l[i]+r[n-i]);}return rs;}
#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...