Kuo is curious about the casino after watching the movie, Twenty One.
There is a casino which opens N days this month.
Whenever someone enters the casino, they have to pay T entrance fee to the casino. The entrance fee may change every day.
There will be two kinds of events in a day.
Everyone's name is composed of at most 4 English letters.
In a Twenty One game:
There will be one banker, one guard, and one server. They have banker_ski, guard_ski, and server_ski skill respectively.
There will be K players playing twenty one; however, ignore those who are blacklisted or not in the casino.
Each of the players places their bets beti first, then draw some cards.
The banker draws the cards last.
Let A be the sum of the i-th player's cards, B be the sum of the banker's.
Then:
For the banker:
For the guard:
For the player:
The banker, the guard, and the server have 0 dollars at the beginning of each Twenty One game.
After each Twenty One game, the money the banker gets will be the casino's income.
If a player is kicked out of the casino by the guard, the player will be blacklisted.
If a person whose amount of money is less than or equal to T, this person will be charged nothing, kicked out, and blacklisted at once.
Those blacklisted are not permitted to enter the casino.
At the end of each day, everyone will leave the casino.
If the amount of income on this day is bigger or equal to a number U, the boss of the casino, JN will feel happy and clear the blacklist.
You can use this code to draw cards.
void Human::Draw() {
this->cards = 0;
string res = "";
while (res.size() <= 0)
getline(cin, res);
stringstream ss(res);
while (ss >> res) {
int temp = 0;
for (auto i : res)
temp = temp * 10 + i - '0';
this->cards += temp;
}
}The first line of the input contains a number N — the number of days in this month.
The following contains N blocks.
The first line of each block is Casino Q T U — it means there will be Q events, the entrance fee is T and the U mentioned in the description this day.
The next Q lines are one of the following:
For a Twenty One event:
The first line of the block contains three numbers — banker_ski, guard_ski, and server_ski.
The second line of the block contains a number K — the number of players.
For the next 2K lines, i = 1, 2, ..., K,
There will be a string namei and a number beti in the 2i - 1 line — the i-th player's name and the bets they place.
There will be some numbers c1, ..., ct in the 2i line — the cards the i-th player has.
The last line of each block will be some numbers c1, ..., ct — the cards the banker has.
N, Q <= 100
K <= 200
server_ski >= 10^4
For every Twenty One game:
The first line of output should contain three numbers banker_money, guard_money, and server_money — the money the guard, the banker, and the server gets.
Each of the next N lines should contain a string namei and moneyi — the name of the player and the money they have after playing, in the order of the time they enter the casino.
You should print a number U at last — how much income the casino gets in this month.
If there are K people blacklisted, you should output their names in K lines in the order they get blacklisted.