Submission #541513

#TimeUsernameProblemLanguageResultExecution timeMemory
541513JomnoiBoxes with souvenirs (IOI15_boxes)C++17
0 / 100
0 ms340 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 = 0; i < N; i++) { if(i - K >= 0) { pre[i] += pre[i - K]; } pre[i] += 2 * p[i]; } for(int i = N - 1; i >= 0; i--) { if(i + K < N) { suf[i] += suf[i + K]; } suf[i] += 2 * (L - p[i]); } long long ans = INF; for(int i = 1; i < N; i++) { ans = min(ans, pre[i - 1] + suf[i]); } 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...