This page is still under construction.

Parts of this page are still being built. What you see may change.

Easy Task

Interview

Time limit1sMemory limit128 MB

Summary
Process a list of contest submissions to compute, for each of nine problems, the number of teams that solved it and the average submissions and solve time.
Level

Easy3 of 10

Topics
Hash map, Simulation, Implementation
Solved
No attempts yet

Problem

After each contest we want to measure how hard every problem was, using the history of submissions.

For each problem we compute three statistics:

  • the number of teams that got the problem accepted,
  • the average number of submissions made by the teams that solved it, and
  • the average time (in seconds from the start of the contest) at which those teams solved it.

Both averages consider only the teams that actually solved the problem. Following the usual contest rule, the time consumed for a solved problem is the time elapsed from the beginning of the contest until the submission of the accepted run.

Write a program that:

  • reads the history of submissions during a contest,
  • for each problem computes the number of accepted solutions, the average number of submissions, and the average time consumed to solve it,
  • prints the result.

Input

The first line contains an integer n (1 ≤ n ≤ 2000), the number of submissions during the contest.

Each of the next n lines describes one submission and contains, separated by single spaces:

  • the submission time in seconds from the start of the contest (a positive integer, at most 18000),
  • a team identifier (a non-empty string of at most five lowercase letters or digits),
  • a problem identifier (a capital letter from A to I), and
  • the result: A if the submission was accepted, or R if it was rejected.

Submissions are listed in nondecreasing order of submission time (equal times are allowed). There are 62 teams competing.

Once a team has an accepted submission for a problem, any further submissions of that same problem by that team may appear in the input but must be ignored in the statistics.

Output

Print exactly nine lines. The first line corresponds to problem A, the second to problem B, and so on through problem I.

For a problem with no accepted solution, print the problem identifier followed by a single 0.

Otherwise print, separated by single spaces: the problem identifier, the number of teams that solved it, the average number of submissions made by those teams, and the average time at which they solved it. Both averages are rounded to two decimal places, rounding a halfway value up (away from zero).

Examples1

  1. Example 1

    Input
    12
    10 wawu1 B R
    100 chau1 A A
    2000 uwr2 B A
    2010 wawu1 A R
    2020 wawu1 A A
    2020 wawu1 B A
    4000 wawu2 C R
    6000 chau1 A R
    7000 chau1 A A
    8000 pp1 A A
    8000 zil2 B R
    9000 zil2 B A
    
    Expected output
    A 3 1.33 3373.33
    B 3 1.67 4340.00
    C 0
    D 0
    E 0
    F 0
    G 0
    H 0
    I 0