Submission #798549

#TimeUsernameProblemLanguageResultExecution timeMemory
798549HaroldVemenoBoxes with souvenirs (IOI15_boxes)C++17
15 / 100
1 ms212 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; using ll = long long; ll dp[10000000]; long long delivery(int n, int k, int l, int p[]) { for(int i = 0; i < min(n, k); ++i) { dp[i] = min({2*p[i], 2*(l-p[0]), l}); } for(int i = k; i < n; ++i) { dp[i] = dp[i-k] + min({2*p[i], 2*(l-p[i-k+1]), l}); } ll res = 1ll << 60; for(int i = max(0, n-k-1); i < n-1; ++i) { res = min(res, dp[i] + min({2*p[n-1], 2*(l-p[i+1]), l})); } if(0) { for(int i = 0; i < n; ++i) { cout << dp[i] << ' '; } cout << '\n'; } return res; }
#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...