제출 #1109806

#제출 시각아이디문제언어결과실행 시간메모리
1109806raspy선물상자 (IOI15_boxes)C++17
100 / 100
538 ms291776 KiB
#include "boxes.h" #include <bits/stdc++.h> using namespace std; #define ll long long ll dp[10000005]; ll dp1[10000005]; long long delivery(int n, int k, int l, int p[]) { for (int i = 1; i <= n; i++) { if (i >= k) dp[i] = dp[i-k]+2ll*(p[i-1]); else dp[i] = 2ll*(p[i-1]); } for (int i = 1; i <= n; i++) { if (i >= k) dp1[i] = dp1[i-k]+2ll*(l-p[n-i]); else dp1[i] = 2ll*(l-p[n-i]); } ll rez = dp[n]; for (int i = 0; i <= n; i++) { rez = min(rez, dp[i]+dp1[n-i]); if (n-i-k >= 0) rez = min(rez, dp[i]+dp1[n-i-k]+l); } return rez; }
#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...