Submission #445133

#TimeUsernameProblemLanguageResultExecution timeMemory
445133fuad27Boxes with souvenirs (IOI15_boxes)C++14
100 / 100
553 ms195972 KiB
#include<bits/stdc++.h> using namespace std; long long delivery(int n, int k, int l, int p[]) {long long pref[n], suf[n];for(int i = 0;i<n;i++) {if(i >= k)pref[i] = pref[i-k] + min(p[i]*2, l);else pref[i] = min(p[i]*2, l);int j = n - i - 1;if(n - j - 1 >= k)suf[j] = min(l, 2*(l - p[j])) + suf[j+k];else suf[j] = min(l, 2*(l - p[j])); }long long ans = min(suf[0], pref[n-1]);for(int i = 0;i<n-1;i++)ans = min(ans, pref[i]+suf[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...