Under construction

Still being built. Things may change

Ideal Contest

Time limit1sMemory limit128 MB

Summary
Parse an ASCII contest scoreboard and compute several weighted penalty metrics (vainness, oversimplification, evenness, unsolvability, instability per problem) into a total negidealness score.
Level

Medium6 of 10

Topics
Implementation, Simulation, String
Solved
No attempts yet

Problem

There is no higher-level championship that ranks the regional and subregional programming contests themselves, largely because whole contests are hard to compare. Here is one way to do it. We measure how far a contest's result table is from an "ideal" contest with a quantity called negidealness — a weighted sum of the penalties below. Throughout, let TT be the number of participating teams and PP the number of problems.

Vainness VV. Every team should solve at least one problem. For each team that solves no problem, add 1/T1/T.

Oversimplification OO. No team should solve every problem. For each team that solves all PP problems, add 1/T1/T.

Evenness EE. The number of problems solved should decrease smoothly down the standings. Teams are listed in standings order. For each pair of teams adjacent in the standings whose solved counts differ by d>1d > 1, add (d−1)/P(d-1)/P — one 1/P1/P for every solved-count value skipped between them. For example, if one team solves 5 problems and the next solves 1, then 2, 3 and 4 are skipped and 3/P3/P is added.

Unsolvability UU. Every problem should be solved by at least one team. For each problem that no team solves, add 1/P1/P.

Instability I1,I2,…,IPI_1, I_2, \dots, I_P. If some team solves problem pp, then every team ranked above it should also solve pp. For problem pp, take the lowest-ranked team that solved pp; for each team ranked strictly above that team (a strictly smaller rank number) that did not solve pp, add 1/T1/T to IpI_p. If no team solves pp, then Ip=0I_p = 0.

The total negidealness is N=1.03 V+3.141 O+2.171 E+1.414 U+I1+I2+⋯+IPP.N = 1.03\,V + 3.141\,O + 2.171\,E + 1.414\,U + \frac{I_1 + I_2 + \dots + I_P}{P}.

Write a program that computes every penalty and the total negidealness for a given result table.

Input

The input is a contest result table in plain ASCII. The only whitespace character is the space, and columns are separated by at least one space.

  • The table starts with a header block of zero or more arbitrary lines, then a column-title line, then a separator line made up entirely of hyphens (-).
  • The column-title line contains the word Team, then the problem letters (capital letters A, B, … in alphabetical order), then =, Time, and R.
  • Each line after the separator describes one team, listed in standings order (by rank). A team line contains the team name (which may itself contain spaces), then one cell per problem in order, then three integers: the number of problems the team solved, its penalty time, and its rank R.
  • A problem cell is + or +k if the team solved that problem (with kk earlier wrong attempts), -k if the team only made wrong attempts, or . if it never tried. A team has solved a problem exactly when its cell begins with +.
  • Rank numbers may repeat (ties). One team is ranked above another only when its rank number is strictly smaller.

There are at most 26 problems and at most 300 teams.

Output

Print, each on its own line:

  • Vainness = followed by VV,
  • Oversimplification = followed by OO,
  • Evenness = followed by EE,
  • Unsolvability = followed by UU,
  • Instability p = followed by IpI_p for p=1,2,…,Pp = 1, 2, \dots, P,
  • Negidealness = followed by NN.

Every value is printed rounded to exactly three digits after the decimal point. The test data is chosen so that no value ever lands on a rounding boundary, so any correct rounding to three decimals produces the same text.

Examples3

  1. Example 1

    Input
       The contest header may contain
          arbitrary number of lines
    Team          A  B C  D  E   = Time R
    -------------------------------------
    Revda STU     + +  +2 +1 -9  4 9274 1
    Girvas NU #1  +  + -1 .  -11 2 321  2
    Kargopol SU   + -3 +  .  -4  2 321  2
    Utorgosh SU   . .  .  +  -5  1 122  4
    Dubrovno SU   . +  -1 .   -4 1 123  5
    Girvas NU - 2 . .  .  -5 -99 0 0    6
    
    Expected output
    Vainness = 0.167
    Oversimplification = 0.000
    Evenness = 0.200
    Unsolvability = 0.200
    Instability 1 = 0.000
    Instability 2 = 0.333
    Instability 3 = 0.000
    Instability 4 = 0.333
    Instability 5 = 0.000
    Negidealness = 1.022
    
  2. Example 2

    Input
    Regional Warmup Round
    Team       A B C = Time R
    -------------------------
    Alpha      + + + 3 100 1
    Bravo      + + + 3 150 2
    Charlie    + + + 3 200 3
    
    Expected output
    Vainness = 0.000
    Oversimplification = 1.000
    Evenness = 0.000
    Unsolvability = 0.000
    Instability 1 = 0.000
    Instability 2 = 0.000
    Instability 3 = 0.000
    Negidealness = 3.141
    
  3. Example 3

    Input
    City Qualifier
       two header lines here
    Team        A  B  C  = Time R
    -----------------------------
    Falcon Team + +  .   2 45  1
    Owl Squad   + -1 -2  1 80  2
    Newbie One  . .  .   0 0   3
    
    Expected output
    Vainness = 0.333
    Oversimplification = 0.000
    Evenness = 0.000
    Unsolvability = 0.333
    Instability 1 = 0.000
    Instability 2 = 0.000
    Instability 3 = 0.000
    Negidealness = 0.815