Submission #1084929

#TimeUsernameProblemLanguageResultExecution timeMemory
1084929yeediotBoxes with souvenirs (IOI15_boxes)C++17
0 / 100
0 ms600 KiB
//#include "boxes.h" #include<bits/stdc++.h> using namespace std; #define pb push_back long long delivery(int n, int k, int l, int p[]){ vector<int>pos; for(int i = 0; i < n; i++){ pos.pb(p[i]); } if(k == n){ return l; } vector<long long>ldp(n + 10), rdp(n + 10); for(int i = 1; i <= n; i++){ ldp[i] = ldp[max(i - k, 0)] + pos[i - 1] * 2; } for(int i = n; i >= 1; i--){ rdp[i] = rdp[min(i + k, n + 1)] + (l - pos[i - 1]) * 2; } long long ans = 8e18; for(int i = 0; i <= n; i++){ ans = min(ans, ldp[i] + rdp[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...