Volleyball Stats

No attempts yetTime limit1sMemory limit128 MB

Problem

You are writing a program that reads a play-by-play description of a volleyball game and produces a statistics report for one team.

Your program reads a sequence of input lines, each describing one play. Table 1 lists the play types.

KeyPlayDescription
CCHECKINMarks the start of a new game. Every game begins with exactly one CHECKIN line that lists all players from one team who take part in that game.
HHITA hit that the opponent successfully defended.
KKILLA hit that the opponent failed to defend.
EERRAn erroneous hit that went into the net or out of bounds.
BBLOCKA successful defense of a hit at the net.
DDIGA successful defense of a hit behind the net.
RREPORTTells your program to print a report. After printing it, discard every play collected so far and keep processing the rest of the input from a clean state.

Table 1: Plays

Every play except CHECKIN and REPORT carries exactly one 2-digit player number. Each digit of a player number is between 0 and 5, so a referee can signal it with 0 to 5 fingers on each hand.

For each report, compute the statistics in Table 2 for every player who took part in at least one game, and the same statistics for the whole team.

LabelFormulaDescriptionSample
Hit %(sum(KILL) - sum(ERR)) / (sum(KILL) + sum(ERR) + sum(HIT))Hitting percentage0.461
KPGsum(KILL) / #GamesKills per game5.613
BPGsum(BLOCK) / #GamesBlocks per game3.100
DPGsum(DIG) / #GamesDigs per game2.050

Table 2: Statistics

Clarifications:

  • A player "takes part in a game" exactly when that player appears on that game's CHECKIN line. A player is still listed in the report even if they never recorded a play, in which case all of their statistics are 0.000.
  • For a player, #Games is the number of games that player took part in (the number of CHECKIN lines that listed the player). For the team, #Games is the total number of games in the report period. The hitting percentage does not depend on #Games.
  • If a player has no hits, no kills, and no errors, their hitting percentage is 0.000.

Input

Each input line contains exactly one play. Column 1 holds one of the play keys from Table 1.

  • A REPORT line contains only the key R.
  • A CHECKIN line has a blank in column 2, then a two-digit integer NP (06 <= NP <= 15) in columns 3 to 4 giving the number of players in the game, followed by that many 2-digit player numbers (with leading zeros), each preceded by exactly one blank. No play in a game ever names a player who is not on that game's CHECKIN line.
  • A HIT, KILL, ERR, BLOCK, or DIG line has a blank in column 2 and exactly one 2-digit player number (with a leading zero when needed) in columns 3 to 4.

Output

Each time you read a REPORT, print a report.

The first two lines of every report are exactly these (the second line is 41 dashes):

Player  Hit Pct    KPG      BPG      DPG
-----------------------------------------

Then print one line per player who took part in at least one game, in ascending order of player number, formatted like this:

55      s0.000   99.999   99.999   99.999

s is the sign of the hitting percentage: + when the hitting percentage is >= 0.000, and - otherwise. All four values are printed with exactly three digits after the decimal point.

After the player lines, print one team line in the same format, using the literal label team:

team    s0.000   99.999   99.999   99.999

Field layout: the player number (or the label team) is left-justified in an 8-character field; the signed hitting percentage occupies the next 6 characters; and KPG, BPG, and DPG are each right-justified in a 9-character field. No statistic ever exceeds 99.999 in magnitude.

Separate two consecutive reports with a single blank line, and do not print a blank line after the final report.