Submission #1032585

#TimeUsernameProblemLanguageResultExecution timeMemory
1032585socpiteBoxes with souvenirs (IOI15_boxes)C++17
100 / 100
530 ms293668 KiB
#include "boxes.h" #include<bits/stdc++.h> using namespace std; const int maxn = 1e7+5; const long long INF = 1e18; long long cnt[maxn], ans[maxn], dp[maxn]; long long delivery(int N, int K, int L, int p[]) { memset(dp, 0, sizeof(dp)); for(int i = 0; i < N; i++){ dp[i%K] += p[i] + min(p[i], L - p[i]); ans[i+1] = dp[i%K]; } long long re = ans[N]; memset(dp, 0, sizeof(dp)); reverse(p, p + N); for(int i = 0; i < N; i++){ dp[i%K] += L - p[i] + min(p[i], L - p[i]); re = min(re, dp[i%K] + ans[N - (i+1)]); } return re; }
#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...