제출 #432411

#제출 시각아이디문제언어결과실행 시간메모리
432411snasibov05선물상자 (IOI15_boxes)C++14
100 / 100
621 ms220976 KiB
#include "boxes.h" #include <vector> #include <algorithm> using namespace std; #define ll long long #define pii pair<int, int> #define oo 1000000000000000000ll long long delivery(int n, int k, int l, int p[]) { vector<ll> pref(n), suf(n+1); for (int i = 0; i < n; ++i) { if (i - k >= 0) pref[i] = pref[i-k]; pref[i] += min(2ll*p[i], 1ll*l); } for (int i = n-1; i >= 0; --i) { if (i + k < n) suf[i] = suf[i+k]; suf[i] += min(2ll*(l - p[i]), 1ll*l); } ll ans = suf[0]; for (int i = 0; i < n; ++i) { ans = min(ans, pref[i] + suf[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...