Bear and Game

aro001 5th CPU CSE Programming C...
Limits 1s, 512 MB

"Your life is over, you haven't noticed yet!!!" Masha shouted. "What are you

Bear was playing a computer game. There were N enemies and he had to kill
them all. Each of the enemies had power P. He can attack them with attacking
power A. When an enemy is attacked the power of the enemy becomes ((PA)+

There are three types of attacks:

 Bear can attack an enemy without any weapon. Bear loses 1 HP and the
power of this attack is 1.

 Bear can stab an enemy with a knife. Bear loses 1 HP and the power of this
attack is 2.

 Bear can attack an enemy with an M416 rifle. Bear loses 1 HP and the
power of this attack is 5.

Now he thinks that there is a lot of things to do in life. So he is no more interested
to waste time playing the game. But he is curious whether he could win the game
or not. Bear wins the game if all the enemies are dead and he has a non negative
HP. He would be happy if he could win the game.As you are a great programmer,
Bear asked you about the result of the game.

You will be given an integer T (1<=T<=100) the number of test cases. For each
test case there are two integers N and H (1<=N<=10^5, 0<=H<=10^5) the number
of enemies and the HP of Bear. Then follows N integers a1,a2, where ai is
the current power of ith enemy.(1<=ai<=10^5).

For each test case you have to print a line with test case number and “ :-)” if Bear
could win otherwise “ :-(“.


3 10
10 2 3
3 2
10 2 3
Case 1: :-)
Case 2: :-(


Login to submit.


82% Solution Ratio
Nazmul_HossinEarliest, Mar '20
Asif_AlimFastest, 0.0s
Nazmul_HossinLightest, 0 B
mdvirusShortest, 315B
Toph uses cookies. By continuing you agree to our Cookie Policy.