Type: Default 1000ms 256MiB

trip

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

A.trip

题目描述

张三要进行 NN天的旅行,第 ii天的费用为 AiA_i 。他还可以使用优惠券,可以免除 DD天(不用连续)的费用,价格为 PP 。如果剩余 22天,优惠券的作用是 33天,那么依然可以使用。

求这 NN天旅行的最小费用。

输入格式

第一行有 33 个整数 N,D,PN , D , P

第二行有 NN 个整数,第 ii 个为 AiA_i

输出格式

输出最小花费

样例

5 2 10
7 1 6 3 6
20
8 3 1000000000
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000
3000000000

数据范围与提示

  • 1N21051 \leq N \leq 2*10^5
  • 1D21051 \leq D \leq 2*10^5
  • 1P1091 \leq P \leq 10^9
  • 1Ai1091 \leq A_i \leq 10^9

样例一解释

  • 使用一张优惠券免除 1,31,3 天的费用,总费用为 1+3+6+10=201+3+6+10 = 20

0226B

Not Attended
Status
Done
Rule
IOI
Problem
4
Start at
2026-2-26 8:00
End at
2026-2-26 11:39
Duration
3.7 hour(s)
Host
Partic.
80