Submission #513871

#TimeUsernameProblemLanguageResultExecution timeMemory
513871status_codingBoxes with souvenirs (IOI15_boxes)C++14
0 / 100
0 ms332 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] = p[i-1]; if(i>=k) dp[i] += dp[i-k]; } for(int i=n;i>=1;i--) { dp2[i] = l-p[i-1] +1; 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...