Submission #519584

#TimeUsernameProblemLanguageResultExecution timeMemory
519584silverfishBoxes with souvenirs (IOI15_boxes)C++14
25 / 100
34 ms78588 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; using ll = long long; const int N = 10000007; ll dp[N], p[N]; long long delivery(int n, int k, int L, int P[]) { ll l = L; fill(dp, dp+N, 1e18+10); sort(P, P+n); for(int i = 0; i < n; ++i) p[i+1] = P[i]; dp[0] = 0; for(int i = 1; i <= n; ++i){ ll mn = min(l, 2LL*p[i]); for(int j = i; j > max(i-min(k,100), 0); --j){ ll cmn = min(mn, 2LL*(l-p[j])); dp[i] = min(dp[i], dp[j-1] + cmn); } } return dp[n]; }
#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...