제출 #899035

#제출 시각아이디문제언어결과실행 시간메모리
899035oblantis선물상자 (IOI15_boxes)C++17
100 / 100
482 ms294024 KiB
#include "boxes.h" #include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> #define all(v) v.begin(), v.end() #define pb push_back #define ss second #define ff first #define vt vector using namespace std; //using namespace __gnu_pbds; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<double, int> pdi; const ll inf = 1e18 + 10000; const int mod = 1e9+7; const int maxn = 1e5 + 12; long long delivery(int n, int k, int l, int p[]) { ll ret = inf; ll s[n + 1], pr[n + 1]; s[n] = pr[n] = 0; for(int i = n - 1; i >= 0; i--){ int x = p[i], y = p[min(i + k - 1, n - 1)]; s[i] = min({y * 2, (l - x) * 2, l}); s[i] += s[min(n, i + k)]; } ret = s[0]; for(int i = 0; i < n; i++){ int x = p[max(0, i - k + 1)], y = p[i]; pr[i] = min({y * 2, (l - x) * 2, l}); if(i >= k)pr[i] += pr[i - k]; ret = min(ret, pr[i] + s[i + 1]); } return ret; } //int main(){ //int n, k, l; //cin >> n >> k >> l; //int p[n]; //for(int i = 0; i < n; i++){ //cin >> p[i]; //} //cout << delivery(n, k, l, p); //return 0; //}
#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...