Submission #1091551

#TimeUsernameProblemLanguageResultExecution timeMemory
1091551triplem5dsBoxes with souvenirs (IOI15_boxes)C++14
100 / 100
567 ms293828 KiB
#include "boxes.h" #include <bits/stdc++.h> long long cost1[10000007]; long long cost2[10000007]; using namespace std; long long delivery(int N, int K, int L, int p[]) { for(int i = 0; i < K; i++) { long long cur1 = 0, cur2 = 0; for(int j = i; j < N; j+=K) { cur1 += min(p[j]*2,L); cur2 += min((L-p[N-1-j])*2,L); cost1[j] = cur1; cost2[N-1-j] = cur2; } } long long ans = min(cost1[N - 1], cost2[0]); for(int i = 0; i < N - 1; i++) { ans = min(ans, cost1[i] + cost2[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...