#P1687. 机器人小Q

机器人小Q

Description

After successfully delivering a big order, the restaurant decided to bring in a new member: Robot Xiao Q. Xiao Q’s arrival brought in many more customers, but after a while a new problem appeared. Unlike us, Xiao Q needs energy input to keep going. The energy menu already lists NN units of energy in a fixed order, but because their sources differ, ingesting each unit takes a certain amount of time. Xiao Q’s maximum charging time per day is 119119; if this limit is exceeded, he will crash automatically. Everyone wants Xiao Q to stay, so after some research, HWX and XYF went to negotiate with the boss. From LXC’s point of view, he does not want to hear any sob story; he only wants to know: to let Xiao Q obtain KK units of energy (that is, you may skip some units on the menu), what is the minimum number of days needed for charging?

Input Format

The first line contains two integers N,KN, K, meaning there are NN energy units on Xiao Q’s menu, and we want to obtain KK of them.

The second line contains NN integers, where the ii‑th integer is the charging time required for the ii‑th energy unit.

Output Format

Output a single line containing one integer: the minimum number of days required.

If it is impossible to meet the requirement, output You can't do it..

7 3
1 119 119 1 120 120 118

2

Hint

Sample Explanation

Accept only 1,1,1181,1,118. Obviously, this takes 22 days.

Constraints

For 30%30\% of the testdata, 1KN201 \le K \le N \le 20.

For 100%100\% of the testdata, 1KN30001 \le K \le N \le 3000.

Translated by ChatGPT 5