Submission #392483

#TimeUsernameProblemLanguageResultExecution timeMemory
392483my99nBoxes with souvenirs (IOI15_boxes)C++14
0 / 100
1 ms332 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; long long cwtour[1000100], cwwtour[1000100]; long long delivery(int N, int K, int L, int p[]) { for (int i = 0; i < N; i++) cwtour[i] = p[i] + (i<K? 0 : cwtour[i - K]); for (int i = N-1; i >= 0; i--) cwwtour[i] = L-p[i] + (i+K>=N? 0 : cwwtour[i + K]); long long ans = 1e18; for (int i = 0; i < N-1; i++) ans = min(ans, 2*cwtour[i]+2*cwwtour[i+1]); for (int i = 0; i < N-K-1; i++) ans = min(ans, 2*cwtour[i]+2*cwwtour[i+K+1]+L); 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...