제출 #70561

#제출 시각아이디문제언어결과실행 시간메모리
70561Navick선물상자 (IOI15_boxes)C++17
100 / 100
504 ms196168 KiB
#include <bits/stdc++.h> #include "boxes.h" #define F first #define S second #define pii pair<int, int> #define pb push_back using namespace std; typedef long long ll; typedef long double ld; const int maxN = 1e7 + 10; ll dp[maxN], pd[maxN]; long long delivery(int n, int k, int L, int p[]) { for (int i=1; i<=n; i++) { int j = max(0, i - k); dp[i] = dp[j] + min((ll)L, 2LL * p[i - 1]); } for (int i=n-1; i>=0; i--) { int j = min(n, i + k); pd[i] = pd[j] + min((ll)L, 2LL*(L - p[i])); } ll ans = (ll)n * L; for (int i=0; i<=n; i++) ans = min(ans, dp[i] + pd[i]); 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...