제출 #1084929

#제출 시각아이디문제언어결과실행 시간메모리
1084929yeediot선물상자 (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...