Submission #514827

#TimeUsernameProblemLanguageResultExecution timeMemory
514827status_codingBoxes with souvenirs (IOI15_boxes)C++14
100 / 100
816 ms270448 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; long long dp[10000005]; long long dp2[10000005]; long long delivery(int n, int k, int l, int p[]) { sort(p, p+n); for(int i=1;i<=n;i++) { dp[i] = min(2*p[i-1], l); if(i>=k) dp[i] += dp[i-k]; } for(int i=n;i>=1;i--) { dp2[i] = min(2*(l-p[i-1]), l); if(i+k <= n) dp2[i] += dp2[i+k]; } long long ans=1e18; for(int i=0;i<=n;i++) ans=min(ans, dp[i]+dp2[i+1]); 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...