Type: Default 1000ms 256MiB

购物

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.

题目描述

双十一,很多人在疯狂地购物。

商家推出了各种各样的优惠活动,吸引顾客购买更多的商品。

某商家推出如下的优惠活动:

该商家共有 nn 件商品,单独购买第 ii 件商品的费用为 aia_i。顾客也可以花费 ww 购买 一张优惠券,一张优惠卷最多可兑换 mm 件商品(无需额外付费)。顾客可以购买任意张优惠券;

如果最后商品不足 mm 件,优惠券也可以使用。

求顾客购买完所有 nn 件商品的最小费用。

输入格式

第一行有 33 个整数 n,m,wn, m, w

第二行有 nn 个整数,第 ii 个为 aia_i,表示第 ii 件商品的费用。

输出格式

购买所有商品的最小费用。

样例 #1

样例输入 #1

5 2 8
2 7 1 8 4

样例输出 #1

15

样例 #2

样例输入 #2

5 3 8
6 7 4 8 9

样例输出 #2

16

提示

样例解释

样例 11 说明:

花费 88 买一张优惠券,兑换第 22、第 44 件商品;第 11、第 33、第 55 件商品直接购买。

共花费 8+2+1+4=158 + 2 + 1 + 4 = 15

样例 22 说明:

花费 1616 购买两张优惠券,能兑换所有商品。

数据范围

对于 30%30\% 的数据,满足 1n103,1m103,1w109,1ai1091 \leq n \leq 10^3,1 \leq m \leq 10^3,1 \leq w \leq 10^9,1 \leq a_i \leq 10^9

对于 100%100\% 的数据,满足 1n2×105,1m2×105,1w109,1ai1091 \leq n \leq 2 \times 10^5,1 \leq m \leq 2 \times 10^5,1 \leq w \leq 10^9,1 \leq a_i \leq 10^9

2025年入门组测试一(2025.1.21)

Not Attended
Status
Done
Rule
IOI
Problem
6
Start at
2025-1-22 16:30
End at
2025-1-22 21:30
Duration
5 hour(s)
Host
Partic.
6