F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Crazy Basketball Fan

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 170    Accepted Submission(s): 74


Problem Description
Alex is a big fan of basketball and he enjoys watching NBA matches. But as he always has classes in the morning when the game is on, he has to read literal living broadcast with his cellphone instead of TV live. The living broadcast gives messages about who scores or who gets the rebound, etc. After watching a few games with his cellphone, Alex finds a problem. After each game, he wants to know the status of the players (score, reboundĄ­) but the system always fails to give. So Alex decides to calculate himself. Can you help him? If one of your teammates is a crazy basketball fan, you should make him solve this problem because he will find it interesting while working on this problem.
 

Input
The first line of input contains an integer t (t<=10) indicate the number of cases.

In each case, the first line contains the names of the two teams in the form of "A vs B", where A stands for the name of home team and B stands for the name of away team. The following 12 lines contain the name of the players play for the home team and another 12 lines contain the name of the players play for the away team. The first five players of each team will be the starters meaning they are on court when the game starts. All the names only contain letters from 'a' to 'z' and 'A' to 'Z' and ''' without space and the length of each name is no more than 20. All the players' names in one case will be different.

Then a line contains an integer n (2<=n<=500) indicates the number of the messages given by the broadcast.

The next n lines contain the messages, one message per line. The first line will always contain "Begin" and the last line will always contain "End". The game won't end during a shot or free throw, but may end at any other time. A message in other lines may be one of the following (x, x1 and x2 stand for players from the teams, m and M stand for numbers):

Jump Ball x1 vs x2: this message will only be given on the second line right after "Begin". This means two players from different teams are jumping for the ball. This message will always be followed by "x Hold Ball" and x could be anyone.

x Hold Ball: this message will be given if the ball is currently in no one's hand, which means: after jump ball or after a shot was made (including the last free throw) or after a shot was blocked or after timeout.

x1 Pass to x2: this means the ball is passed from x1 to x2. x1 is deferent from x2 and they are from the same team.

Layup/Slam Dunk/Hook Shot/Jump Shot/3pt Shot: the first four messages stand for an attempt for 2-point shot while the last message stand for an attempt for 3-point shot. These messages will only be given when someone is currently holding the ball. These messages may be followed by "Made"/"Missed"/"Blocked by x"/"x Foul".

Made/Missed: If a shot was made and scored, "Made" will be given, otherwise "Missed". These two messages will be given right after a shot was attempted if the shot was not fouled or blocked. If the shot was fouled, these two messages will still be given right after "x Foul" to indicate whether the shot was made even with the foul. But if a shot was blocked, these messages will not be given since the shot is definitely missed.

x Rebound: If a shot was missed, this message will be given to indicate who get the rebound (could be anyone from both teams). If someone gets the rebound, he holds the ball.

Blocked by x: If a shot is blocked, this message will be given right after the message which indicates the shot. This message will always be followed by "x Hold Ball" and x could be anyone. A shot will only be blocked by a player from the opposite team with the shooter.

x Foul: this message will be given when a player commit a foul to another player from the opposite team. There are two kind of foul. If this message is given right after the shot attempt, then this foul will lead to free throws. Otherwise this message will be followed by "x Hold Ball".

Free Throw m of M: If a shot is fouled, the shooter will make free throws. If the fouled shot is made, then the shooter will only make one free throw. If it's missed and it's a 2-point shot, the shooter will make two free throws. If it's missed and it's a 3-point shot, the shooter will make three free throws. Each made free throw earns one point. In this message, m indicates the number of this free throw (start from 1) and M indicates the number of total free throws this player is going to attempt. Both m and M will be no bigger than 3 and m is no bigger than M. After each free throw there will be a message says "Made" or "Missed" to indicate whether the free throw is made or missed. If the last free throw is missed, just like normal shot, someone will get the rebound and if it's made, a player from the opposite team will hold the ball. No block could be made during the free throws.

x Steal: If a player is now holding the ball, a player from the opposite team could steal the ball away. If someone steals the ball, he will hold it.

x1 Substitution replaced by x2: this message means x1 is off court and replaced by x2. x1 and x2 are from the same team. This could only happen during timeout or before free throw or after a foul which doesn't lead to free throw. The player who is going to make a free throw won't be replaced. Before free throw means before any "Free Throw m of M" despite of m and M.

Timeout: timeout could be called when someone is holding the ball. During timeout, substitution could be made. Timeout is ended with the message "x Hold Ball".

It is guaranteed that all the messages are valid and follow the rules. The names of the players will not be the same with words like "rebound" and "block", etc. Actually all the names will be familiar to you if you watch NBA a lot.

 

Output
The first output line for each case will be "x1 n1-n2 x2", where x1 and x2 stand for the name of home team and away team and n1 and n2 stand for their total points.

Then for each player from each team, calculate the number of his points, rebounds (including offensive and defensive), assists, steals, blocks and fouls. An assist is made when player x1 passes to player x2 and x2 makes a shot (2-pt or 3-pt) and then x1 gets the assist. A rebound is an offensive rebound when the shoot and the player who gets the rebound are from the same team (even the same player); otherwise it's a defensive rebound. Also you have to calculate the number of a player's made field goals (including 2-pt and 3-pt), attempted field goals (including 2-pt and 3-pt), made 3-pt shots, attempted 3-pt shots, made free throws and attempted free throws.

Notice: if a shot is fouled and it's missed, it won't be counted as an attempt, but if it's fouled and made, it will be counted as an attempt and a made.
The output form is shown in the sample output (PTS - points, OFF - offensive rebound, DEF - defensive rebound, REB - total rebound, AST - assist, STL - steal, BLK - block, PF - personal foul, FGM-A - field goal made and attempted, 3PM-A - 3-pt made and attempted, FTM-A - free throw made and attempted). There are 14 spaces before the word "PLAYER" and exact one space between each column. All the names and numbers are under their column and right alignment. The order of the players is the same with input. Home team first, then comes the away team. If a player didn't play at all (never on court), then you should print "DNP - Coach's Decision" 10 spaces after their names.

Print a single line after each case.

 

Sample Input
1 Lakers vs Celtics DerekFisher KobeBryant RonArtest PauGasol AndrewBynum LamarOdom MattBarnes SteveBlake ShannonBrown LukeWalton DerrickCaracter DevinEbanks RajonRondo RayAllen PaulPierce KevinGarnett ShaquilleO'Neal JeffGreen VonWafer GlenDavis JermaineO'Neal TroyMurphy NenadKrstic CarlosArroyo 17 Begin Jump Ball KevinGarnett vs PauGasol KobeBryant Hold Ball KobeBryant Pass to PauGasol Slam Dunk Made RajonRondo Hold Ball RajonRondo Pass to PaulPierce Jump Shot RonArtest Foul Missed Free Throw 1 of 2 Made Free Throw 2 of 2 Missed PauGasol Rebound End
 

Sample Output
Lakers 2-1 Celtics Lakers PLAYER PTS OFF DEF REB AST STL BLK PF FGM-A 3PM-A FTM-A DerekFisher 0 0 0 0 0 0 0 0 0-0 0-0 0-0 KobeBryant 0 0 0 0 1 0 0 0 0-0 0-0 0-0 RonArtest 0 0 0 0 0 0 0 1 0-0 0-0 0-0 PauGasol 2 0 1 1 0 0 0 0 1-1 0-0 0-0 AndrewBynum 0 0 0 0 0 0 0 0 0-0 0-0 0-0 LamarOdom DNP - Coach's Decision MattBarnes DNP - Coach's Decision SteveBlake DNP - Coach's Decision ShannonBrown DNP - Coach's Decision LukeWalton DNP - Coach's Decision DerrickCaracter DNP - Coach's Decision DevinEbanks DNP - Coach's Decision Celtics PLAYER PTS OFF DEF REB AST STL BLK PF FGM-A 3PM-A FTM-A RajonRondo 0 0 0 0 0 0 0 0 0-0 0-0 0-0 RayAllen 0 0 0 0 0 0 0 0 0-0 0-0 0-0 PaulPierce 1 0 0 0 0 0 0 0 0-0 0-0 1-2 KevinGarnett 0 0 0 0 0 0 0 0 0-0 0-0 0-0 ShaquilleO'Neal 0 0 0 0 0 0 0 0 0-0 0-0 0-0 JeffGreen DNP - Coach's Decision VonWafer DNP - Coach's Decision GlenDavis DNP - Coach's Decision JermaineO'Neal DNP - Coach's Decision TroyMurphy DNP - Coach's Decision NenadKrstic DNP - Coach's Decision CarlosArroyo DNP - Coach's Decision
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-02 18:00:54, Gzip enabled