제출 #692056

#제출 시각아이디문제언어결과실행 시간메모리
692056zeroesandones선물상자 (IOI15_boxes)C++17
20 / 100
1 ms304 KiB
#include <bits/stdc++.h> #include "boxes.h" using namespace std; using ll = long long; using pi = pair<ll, ll>; using vi = vector<ll>; #define pb emplace_back ll delivery(int N, int K, int L, int p[]) { ll pref[N + 2] = {}; ll suff[N + 2] = {}; for(int i = 1; i <= N; ++i) { pref[i] = p[i - 1] * 2; if(i > K) pref[i] += pref[i - K]; } for(int i = N; i >= 1; --i) { suff[i] = (L - p[i - 1]) * 2; if(i <= N - K) suff[i] += suff[i + K]; } ll ans = LLONG_MAX; for(int i = 0; i <= N; ++i) { ans = min(ans, pref[i] + suff[i + 1]); } for(int i = 0; i <= K; ++i) { ans = min(ans, pref[i - K] + suff[i + 1] + L); } 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...