Problem I
Kattis Completionist
Katryna has one goal in her life, and that is to solve all the problems published on Kattis. Of course, she can’t do them all at once, as she still has to work on her computer science degree. Also, attempting to solve the most difficult problems early on could hurt her motivation and persistence.
For that reason, she has concocted a plan. Every Kattis problem is assigned a difficulty score $s_ i$. That score can go up and down over time, depending on how difficult Kattis thinks the problem is. Katryna wants to solve so many problems that her score increases by at least $G$ every day, but she wants to solve the easiest problems first.
So Katryna will, at the start of every day, pick the unsolved problem with the lowest difficulty score and solve it (if there are multiple with the lowest difficulty score, she will pick one of them at random). If her score has increased by at least $G$ today, she stops. But if not, she will again pick and solve the unsolved problem with the lowest difficulty score, until either there are no more problems left to solve, or until her score has increased by at least $G$ points today. She repeats this every day until she has solved all the problems.
Assuming all the problems’ difficulty scores does not change, how many days would it take Katryna to solve every Kattis problem?
Input
The first line consists of the integer $N$ and the real number $G$, representing the total number of unsolved Kattis problems, and the lowest score increase Katryna is happy with in a single day.
Then follows a single line with $N$ real numbers, each separated by a space, denoting all the difficulty scores $s_ i$ of the Kattis problems.
Output
Output the number of days Katryna will use to solve all her currently unsolved Kattis problems.
Limits
-
$0 < N \leq 100\, 000$
-
$1.0 \leq G \leq 99.9$
-
$1.3 \leq s_ i \leq 9.6$
-
All real numbers will have exactly one digit after the decimal point.
Sample Input 1 | Sample Output 1 |
---|---|
5 3.0 1.3 1.7 1.7 1.7 3.1 |
3 |
Sample Input 2 | Sample Output 2 |
---|---|
3 2.1 2.0 2.0 2.0 |
2 |
Sample Input 3 | Sample Output 3 |
---|---|
3 3.6 1.3 2.3 2.3 |
2 |