Submission #764192

#TimeUsernameProblemLanguageResultExecution timeMemory
764192SanguineChameleonBoxes with souvenirs (IOI15_boxes)C++17
100 / 100
403 ms215368 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; const long long inf = 1e18L + 20; const int maxN = 1e7 + 20; long long dp[maxN]; long long delivery(int N, int K, int L, int A[]) { for (int i = 0; i < K; i++) { dp[i] = min(min(A[i] * 2, (L - A[0]) * 2), L); } for (int i = K; i < N - 1; i++) { dp[i] = dp[i - K] + min(min(A[i] * 2, (L - A[i - K + 1]) * 2), L); } dp[N - 1] = inf; for (int j = 1; j <= K; j++) { dp[N - 1] = min(dp[N - 1], dp[N - 1 - j] + min(min(A[N - 1] * 2, (L - A[N - 1 - j + 1]) * 2), L)); } return dp[N - 1]; }
#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...