제출 #1109805

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