제출 #974827

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
9748272024-05-03 20:25:04marinaluca선물상자 (IOI15_boxes)C++14
100 / 100
492 ms297484 KiB
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define ll long long
#define xx first
#define yy second
#define all (x) begin(x), end(x)
#define FOR (i, a, b) for (auto i = (a); i < (b); ++ i)
const int NMAX = 1e7;
long long ans[11111111], rez[11111111];
long long delivery (int n, int k, int l, int s[]){
long long mini;
for (int i = 1; i <= n; ++ i){
ans[i] = min (s[i - 1] << 1 , l);
if (i > k){
ans[i] += ans[i - k];
}
}
mini = ans[n];
for (int i = n - 1; i >= 0; -- i){
rez[i] = min ((l - s[i]) << 1, l);
if (i + k < n){
rez[i] += rez[i + k];
}
mini = min (mini, rez[i] + ans[i]);
}
return mini;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...