Submission #213169

#TimeUsernameProblemLanguageResultExecution timeMemory
213169arman_ferdousBoxes with souvenirs (IOI15_boxes)C++17
10 / 100
5 ms384 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 1e7+10; int n, k, l; ll sum1[N], sum2[N]; long long delivery(int _n, int _k, int _l, int p[]) { n = _n, k = _k, l = _l; for(int i = n - 1; i >= 0; i--) { sum2[(n - 1 - i) % k] += (p[i] == 0 ? 0 : l - p[i]); } ll ans = sum2[(n - 1) % k]; for(int i = 0; i < n; i++) { sum2[(n - 1 - i) % k] -= (p[i] == 0 ? 0 : l - p[i]); sum1[i % k] += p[i]; ans = min(ans, sum1[i % k] + (n - i - 2 >= 0 ? sum2[(n - i - 2) % k] : 0)); } return ans * 2ll; }
#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...