| 2025 ICPC, Chula Selection Contest |
|---|
| Finished |
One day, Nobita was asking Doraemon for new gadgets. Their friend, CK Chang, came to visit and heard them talking about going shopping at the 22nd Century Department Store.
CK Chang, who is very smart about money, shared his own special rule. "Doraemon," he said, "I have a rule that helps me buy a lot of things. It's CK Chang's 10x Rule: never buy an item unless you have at least 10 times its price in your pocket before you buy it."
Doraemon thought this was an interesting rule and decided to use it. For example, to buy a "Hopter" (Bamboo Copter) that costs $30, he must have at least $300 in his pocket. After buying it, his money would go down by $30, leaving him with $270.
Doraemon has some money and a list of cool gadgets he wants to buy for Nobita. To get the most items possible, he needs your help.
Your job is to find out the maximum number of gadgets Doraemon can get if he follows CK Chang's 10x Rule. You'll need to figure out the best order for him to buy them in.
The first line contains two integers, $$$n$$$ and $$$m$$$ ($$$1 \le n \le 2 \cdot 10^5, 1 \le m \le 10^{15}$$$) — $$$n$$$ is the number of gadgets available, and $$$m$$$ is the money Doraemon has at start.
The second line has $$$n$$$ numbers: $$$p_1, p_2, ..., p_n$$$ ($$$1 \le p_i \le 10^9$$$) — the price of gadgets.
Output a single integer — the maximum number of gadgets Doraemon can buy.
5 1001 2 4 5 8
5
3 10011 10 12
1
| Name |
|---|


