AtCoder Beginner Contest 153
C
Fennec vs Monster
AtCoder
⌀ 0
原题
← BD →
翻译中…

Problem Statement

翻译中…

Fennec is fighting with $N$ monsters.

翻译中…

The health of the $i$-th monster is $H_i$.

翻译中…

Fennec can do the following two actions:

翻译中…
  • Attack: Fennec chooses one monster. That monster's health will decrease by $1$.
  • Special Move: Fennec chooses one monster. That monster's health will become $0$.
翻译中…

There is no way other than Attack and Special Move to decrease the monsters' health.

翻译中…

Fennec wins when all the monsters' healths become $0$ or below.

翻译中…

Find the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning when she can use Special Move at most $K$ times.

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 2 \times 10^5$
  • $0 \leq K \leq 2 \times 10^5$
  • $1 \leq H_i \leq 10^9$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N K
H_1 ... H_N

翻译中…

Output

翻译中…

Print the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning.

翻译中…

样例

Input #1
3 1
4 1 5
Output #1
5
By using Special Move on the third monster, and doing Attack four times on the first monster and once on the second monster, Fennec can win with five Attacks.
Input #2
8 9
7 9 3 2 3 8 4 6
Output #2
0
She can use Special Move on all the monsters.
Input #3
3 0
1000000000 1000000000 1000000000
Output #3
3000000000
Watch out for overflow.
题目信息
题号
abc153_c
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。