Agar Adventure
You are in your OOP lecture when you realise that you are bored and start playing Agar.io on your laptop. The game is broken such that no other players can move and theres no way for you to grow besides eating other players. You want to know if it possible for you to win (i.e. be the last player standing) in this scenario.
In this game, every player has a mass, and you can only eat players with a mass strictly smaller than yours. When this happens, their mass is added to your mass. The winner of the game is the last person left standing.
Input
The first line consists of a single integer representing your starting mass. The next line consists of another integer
representing the number of other players in the game. The next line consists of
integers seperated by spaces, with
representing the mass of the
th other player.
Output
If it is possible for you to win the game (i.e. eat every other player while only eating players strictly smaller than you and retaining a positive mass), output "Yes!" Otherwise, (if there are 1 or more players it is impossible for you to eat), output "L Bozo."
Example
Input 1
11
4
4 28 15 1
Output 1
Yes!
Explanation 1
Firstly, you can eat players with masses 1 and 4, resulting in your mass being 16. Then, you can eat the player with mass 15, leaving you with a mass of 3, which will allow you to eat the final player with mass 28 and win the game.
Input 2
11
4
4 28 18 1
Output 2
L Bozo.
Explanation 2
Similarly, you can eat both 4 and 1, giving you a mass of 16. However, it is now impossible to eat either 18 or 28 as 16 is smaller, so the game is lost.
Comments