Role fight

Consider a role-playing game where two brave players are fighting for
their honor. Initially, each player has some life points and some mana
points. Taking turns, one player attacks the other one. Each player has
several magical abilities that take some life points from the enemy,
with a specific mana cost for each ability. Logically, choosing an
ability requires having enough mana points. When attacking with no
magic, the enemy loses one life point and the attacker recovers five
mana points (with one bound: the initial mana). The player who first
loses all his life points loses the game.

[]

Write a program to tell the winner of a game, assuming perfect play from
both players.

Input

Input consists of several cases. Every case begins with the name and the
initial life points and mana points of the first player, followed by the
same information about the second player. Follow the number n of
abilities of the first player, followed by n numbers (the damage of each
one), followed by n numbers (the mana cost of each one). Finally, we
have the same information about the second player. Suppose that every
player has at most 50 magical abilities, and that the initial life
points, the initial mana points, the damage of every ability, and the
mana cost of every ability are all between 1 and 30.

Output

For every case, print the name of the winner of the game.

Problem information

Author: Unknown
Translator: Salvador Roura

Generation: 2026-01-25T11:32:14.598Z

© Jutge.org, 2006–2026.
https://jutge.org
