Submission #70561

#TimeUsernameProblemLanguageResultExecution timeMemory
70561NavickBoxes with souvenirs (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...