Problem G
Potion Commotion
You are incredibly close to becoming the Pokemon champion, but one final obstacle stands in your way: the Elite Four. Throughout your journey, you raised your starter Pokemon to a high enough level, and out of a show of loyalty to your favorite Pokemon, you vowed to never catch another Pokemon. This would normally put you at a disadvantage against the toughest trainers in the region, but you know from experience that with enough healing items and preparation, it is possible to power through any fight.
You begin your preparations by running a few calculations. Your only Pokemon has $N$ health initially and will faint if its health ever drops to zero or below. You know that throughout the Elite 4 battles, your Pokemon will be attacked $M$ times by opposing trainers, each attack potentially dealing a different amount of damage. With this in mind, you head straight to the Pokemart and stock up on $P$ potions that heal $20$ health each.
After each time your Pokemon is attacked, you are allowed to use as many potions as you want (until you run out of potions) to heal your Pokemon, although your Pokemon’s health can never increase above $N$. If your Pokemon’s health ever drops to zero or below, it faints and you lose the battle. Given the amount of damage each attack from the opposing Pokemon does, determine if you can make it through the Elite Four without your Pokemon fainting.
Input
The first line of input contains three space-separated integers $N$, $M$, $P$. These represent your Pokemon’s health ($1 \leq N \leq 100\, 000$), the number of attacks by opposing Pokemon ($1 \leq M \leq 1\, 000$), and the number of potions you have ($1 \leq P \leq 100\, 000$).
The second line contains $M$ space-separated integers $d_1, \ldots , d_ M$ ($1 \leq d_ i \leq 100\, 000$) representing the amount of damage dealt by each attack, in order.
Output
Output one line containing champion if your Pokemon can survive every attack or next time if not.
Sample Input 1 | Sample Output 1 |
---|---|
100 3 1 25 35 45 |
champion |
Sample Input 2 | Sample Output 2 |
---|---|
10 3 1 8 9 10 |
next time |