제출 #513872

#제출 시각아이디문제언어결과실행 시간메모리
513872status_coding선물상자 (IOI15_boxes)C++14
0 / 100
0 ms312 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] = 2*p[i-1]; if(i>=k) dp[i] += dp[i-k]; } for(int i=n;i>=1;i--) { dp2[i] = 2*(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...