Submission #650635

#TimeUsernameProblemLanguageResultExecution timeMemory
650635birthdaycakeBoxes with souvenirs (IOI15_boxes)C++17
10 / 100
2 ms340 KiB
#include<bits/stdc++.h> #include "boxes.h" using namespace std; long long delivery(int n, int k, int l, int p[]) { long long ans = 1e18; for(int i = -1; i < n; i++){ long long cur = 0, items = k, cost = 0, dist = 0; for(int j = 0; j <= i; j++){ if(items == 0){ items = k; cost += dist; cur = 0; dist = 0; } cost += (p[j] - cur); dist += (p[j] - cur); cur = p[j]; items--; } cost += dist; items = k; cur = 0; dist = 0; for(int j = n - 1; j > i; j--){ int nw = (l - 1) - p[j] + 1; if(items == 0){ items = k; cost += dist; cur = 0; dist = 0; } cost += (nw - cur); dist += (nw - cur); cur = nw; items--; } ans = min(ans, cost + dist); } 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...