cards are placed face up, adjacent to one another. Each card has a special integer representing its wild factor . On each player's turn, they must find a pair of any two cards which have a combined wild factor of exactly . Once a pair is found, the two cards are removed from the game, and the next player's turn starts. The player who cannot make a valid pair of two cards on their turn loses the game.
and are playing a game called WildCard. In this game,As both
and are amateurs and take a long time to complete a single game, you want to write a program that can calculate the result of their game.Input Specification
On one line, three space separated integers , and , with representing the player who goes first (0
being and 1
being ).
On the second line, space separated integers representing , the wild factor of the card.
Output Specification
On one line output the name of the player who wins the game as well as the number of pairs that he can make, separated by a space.
Sample Input
6 10 1
1 5 2 8 3 9
Sample Output
aurpine 1
Explanation of Sample Output
If or . Either way, after both players each play one turn (each player making one of the valid pairs), there will be no more valid pairs to make and will win having made one pair.
goes first, he can choose to make one of two pairs:
Comments
If , there will be no pairs, since card can't be higher than . Since someone solved this already, I guess it's a typo. Which value has a mistake?
No mistake was made.
Do the cards have distinct wild factors?
Don't assume anything not explicitly stated :D (they don't have to be unique)