Yellow Card and Red Card
Time Limit: 1 Second
Memory Limit: 65536 KB
FIFA has changed its rule on yellow-card amnesties at the World Cup 2010 to reduce the chances of big name players missing out on the July 11 final.
Germany's Michael Ballack in 2002, Italy's Alessandro Costacurta in 1994 and Argentina's Claudio Caniggia in 1990 are the best-known players to have missed World Cup finals after picking up second yellow cards in semis.
So for this tournament, world soccer's governing body has shifted its usual amnesty for yellow cards from the end of the first round until after the quarter-finals instead.
That means players would only miss the final if they receive two yellow cards -- or of course a straight red -- in a semi-final game, rather than in the past when they may have carried one yellow card going into a semi.
"FIFA simply said we want to give the best players a chance to play in the final," spokesman Marius Schneider said.
"The discussion first came up when Ballack was ruled out."
England fans remember the old rule well because of Paul Gascoigne's tears during their semi-final in Italy in 1990.
Although they eventually lost to Germany, the always emotional Gascoigne wept on the pitch when he received a yellow card that would have ruled him out of the final.
Red card rules remain the same.
A red carries at least a one-match suspension and possibly more if the disciplinary committee considers the offence particularly serious. So, in theory, a player red-carded even before a semi-final could also miss the final.
In this question, you should know the following rules:
- A player can get yellow card or red card only when he is on the pitch.
- If a player gets 2 yellow cards in one match, he must get a red card immediately, in this situation, it can be regarded as the player only gets 1 red card directly.
- Whenever a player gets a red card, he should leave the pitch immediately.
- If somebody gets a red card, he must miss one match.
- Besides a red card, if a player gets 2 yellow cards accumulatively (can be received in different matches), he will also miss one match.
- All the yellow cards must be recorded, except a player gets 2 yellow cards in one match.
- If the player has to miss a match because of the 2 accumulative yellow cards, the record of these 2 yellow cards will be erased.
- If a player gets both kinds of cards in the same match, the number of suspension, which results from the accumulation of all cards he has received, will be cumulative.
- All of the punishment of suspension will be executed immediately from the next match.
- The team who got championship played a total of 7 matches (1~3 indicate the first round) in the World Cup 2010.
- In this world cup, no offence is considered particularly serious.
- The change of rules on yellow-card amnesties made by FIFA, namely shifting amnesty for yellow cards from the end of the first round until after the quarter-finals instead, is practical.
Now we only consider the players in the champion team. You should output which one misses which match. In addition, your program should ignore the redundant wrong information in the input (in the order of date and time of matches, previous data is more reliable).
There are several test cases (<=100). You should process to the end of input. There will be several matches for each test case. The first line is "Match i", i (1 <= i <= 7, an integer) indicates the match number. Then, some lines follow, indicating which players get cards in this match in time order with the following form: "player_number card" (0 <= player_number <= 99, an integer, card = "yellow" or "red"). After each case, there is a line "END". Keep in mind that in each line, all different data are separated by one blank.
For each case, you should print which one misses which match. As the sample shows, you should output several lines, each of which is "match_number player_number". Your should print them order by match number first, then order by player number. There is only one blank between match_number and player_number. You also need to output a single line "#" after each case.
For each case, you should print which one misses which match. As the sample shows, you should output several lines, each of which is "match_number player_number" (There is only one blank between match_number and player_number). Besides, please sequence the lines accroding to the match_number (from small to large) first; for lines with same match_number, sequence them according to the player_number (from small to large). You also need to output a single line "#" after each case.
In the World Cup 2006, it happened that a player received three yellow cards in one match because of the referee's mistakes. Please keep in mind that in such cases, only the first two are effective.
Author: SHEN, Xin
Source: ZOJ Monthly, July 2010