Guillotine Card Game
Time limit3sMemory limit128 MB
Compute each player's final score in a three-player card game where one player secretly plays to minimize another player's score.
- Level
Medium7 of 10
- Topics
- Game theory, Backtracking, Recursion
- Solved
- No attempts yet
Problem
A frog, a kappa and a weasel are playing a card game.
The game uses one guillotine, twelve noble cards and six action cards. Every noble card and every action card has one integer written on its face. Before the game starts, the players lay the twelve noble cards in a row on the table and put the guillotine at the right end of the row. Each player is then dealt two action cards. All noble cards and action cards lie face up, so the three players share the whole state of the game.
Turns go in the order frog, kappa, weasel. The frog takes the first turn, the kappa the second, the weasel the third, the frog the fourth, and so on. A turn consists of an action phase and then an execution phase.
In the action phase, a player who still holds action cards may use one of them. Let be the number on the card that was used. If at least noble cards are left on the table, the -th noble card counting from the guillotine moves to the position right in front of the guillotine. If fewer than noble cards are left, nothing happens. In either case the used action card is discarded from the hand. When the row does not change.
In the execution phase, the player removes the noble card right in front of the guillotine and scores the number written on it. This phase cannot be skipped.
The game ends once every noble card has been removed.
Each player follows this strategy.
- Every player assumes that the other players follow a strategy that maximizes their own final score.
- The frog and the weasel really do follow such a strategy.
- The kappa does not. The kappa plays so that the frog's final score is minimized.
- The kappa knows that the frog and the weasel play under a wrong assumption, namely that the kappa maximizes his own score.
- When several choices satisfy a player's objective equally well, that player picks the choice that leaves as many action cards in his own hand as possible at the end of the turn.
- If several choices are still tied, that player picks the choice with the larger total of the numbers on the action cards left in his own hand.
Compute the final score of each of the three players.
Input
The input is formatted as follows.
x12 x11 x10 x9 x8 x7 x6 x5 x4 x3 x2 x1
y1 y2
y3 y4
y5 y6
The first line contains twelve integers (). is the integer on the -th noble card counting from the guillotine, so the last number on the line is the number on the card right in front of the guillotine.
The next three lines contain six integers (). are the numbers on the frog's action cards, are the numbers on the kappa's action cards, and are the numbers on the weasel's action cards.
Output
Print the final scores of the frog, the kappa and the weasel on one line, separated by single spaces.