Submission #716753

#TimeUsernameProblemLanguageResultExecution timeMemory
716753BaytoroBoxes with souvenirs (IOI15_boxes)C++17
0 / 100
2080 ms212 KiB
#include "boxes.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; #define ll long long long long delivery(int n, int k, int L, int p[]) { ll ans=1e18; vector<ll> pref(n+1),suf(n+1); for(int i=0;i<n;i++){ if(i<k) pref[i+1]=0; else pref[i+1]=pref[i+1-k]+p[i]*2; if(i<k) suf[i+1]=(L-p[n-i-1]*2); else suf[i+1]=suf[i+1-k]+(L-p[n-i-1]*2); } for(int i=0;i<=n;i++){ for(int j=i;i<=n;j++){ ll x=(j-i)/k*L; x+=pref[i]; x+=suf[n-j]; ans=min(ans,x); } } 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...