Submission #541514

#TimeUsernameProblemLanguageResultExecution timeMemory
541514JomnoiBoxes with souvenirs (IOI15_boxes)C++17
0 / 100
0 ms212 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; const int MAX = 1e7 + 10; const long long INF = 1e18 + 7; long long pre[MAX], suf[MAX]; long long delivery(int N, int K, int L, int p[]) { for(int i = 1; i <= N; i++) { pre[i] = pre[max(0, i - K)] + p[i] + min(p[i], L - p[i]); } for(int i = N; i >= 1; i--) { suf[i] = suf[min(N + 1, i + K)] + (L - p[i]) + min(p[i], L - p[i]); } long long ans = INF; for(int i = 0; i <= N; i++) { ans = min(ans, pre[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...