P28331 [洛谷] Dirty Priest
提高-
题目描述

Problem Description

Yumis has recently been playing Hearthstone.

In Hearthstone, the Dirty Priest has a one-mana card called "Madness Potion," which can pull an enemy minion with attack power less than or equal to 2 onto their own battlefield.

There is also a four-mana card called "Shadow Madness," which can pull an enemy minion with attack power less than or equal to 3 onto their own battlefield.

Another one-mana card is "Shrink Potion," which reduces the attack power of all enemy minions by 3 points.

You have hacked the Hearthstone GM and thus have an unlimited supply of these three cards. However, the GM told you that the Shrink Potion is difficult to create, and for the GM's sake, you must use the minimum number of Shrink Potions to deal enough damage to your opponent's face.

Currently, your opponent has n minions on the battlefield, each with ki attack power.

Your opponent has m hit points.

What you need to do is to pull the enemy minions onto your own battlefield and have them attack your opponent (each minion can only attack once, with the attack power being the remaining attack power when pulled over), dealing enough damage to reduce your opponent's hit points to 0 or below.

Input Format

The first line contains two integers n and m separated by a space, representing the number of enemy minions and your opponent's hit points, respectively.

The second line contains n integers separated by spaces, representing the attack power ki of each enemy minion.

Output Format

If it is possible to deal enough damage, output the minimum number of Shrink Potions used and the mana crystals consumed, separated by a space (if there are multiple answers, output the one with the least mana crystals consumed).

Otherwise, output "Human Cannot Win Dog" (without quotes).

Sample Input and Output

Sample Input #1

3 5
1 2 3

Sample Output #1

0 5

Sample Input #2

8 8
10 20 30 40 50 60 70 80

Sample Output #2

16 23

Sample Input #3

8 80
10 20 30 40 50 60 70 80

Sample Output #3

Human Cannot Win Dog

Notes

Explanation for Sample #1:

There are 3 enemy minions on the battlefield, and the opponent has 5 hit points.

We pull the 3-attack and 2-attack minions over, using 0 Shrink Potions and 5 mana crystals (one Madness Potion and one Shadow Madness, 1+4 = 5), which is enough to deal sufficient damage.

Explanation for Sample #2:

Using 16 Shrink Potions (the numbers in parentheses indicate the attack power when pulled over and the number of Shrink Potions used):

Pulling over the 10 (1) (3), 20 (2) (6), 30 (3) (9), and 50 (2) (16) attack minions, we deal a total of 8 damage, just enough to deal enough damage.

Difficulty Levels

Easy: Guaranteed 0 < n <= 10 and no need to use Shadow Madness or Shrink Potion - 20%

Normal: Guaranteed 0 < n <= 10 and no need to use Shrink Potion - 20%

Hard: Guaranteed 0 < n <= 10 - 30%

Extra: Guaranteed 0 <= n <= 5000000, maximum attack power less than 30000 - 30%

Guaranteed 0 < n <= 5000000, 0 < ki <= 30000, 0 <= m <= 5000000

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 5 1 2 3
样例输出
0 5