eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Ideal Contest

Ideal Contest

Ліміт часу 3 секунди
Ліміт використання пам'яті 256 MiB

It's a pity that there is no higher-order contest for ACM ICPC regionals and subregionals; probably this is because it's very hard to rank them. But now we have an idea how to do this! The idea is based on a notion of negidealness - a number showing non-conformity of the contest results with "ideal" contest criteria. It is a weighted sum of the following specific negidealnesses (penalties).

Vainness penaltyV. Each team should solve at least one problem. If a team solves no problems, a penalty of 1/T (where T is the number of teams that participated in the contest) for each such team is added.

Oversimplification penaltyO. There should be no team with all the problems solved. If some teams solve all the problems, a penalty of 1/T is added for each such team.

Evenness penaltyE. The number of problems solved by different teams should increase evenly. If the difference in problems solved between two adjacent (in the standings) teams is greater than 1, then the penalty of 1/P (where P is the total number of problems) is added for each skipped number of problems solved. E.g., if a team solves 5 problems, and the next team solves 1 problem, then the penalty of 3/P should be added, since no team solved 2, 3 or 4 problems.

Unsolvability penaltyU. Every problem should be solved by at least one team. If a problem is not solved, a penalty of 1/P for each such problem is added.

Instability penaltiesI_1, I_2, ..., I_P. If a problem p was solved by a team, then this problem should be solved by all the teams ranked above. For each team which did not solve problem p ranked above the lowest-ranked team that did solve problem p a penalty of 1/T is added to I_p.

The total negidealnessN equals 1.03V + 3.141O + 2.171E + 1.414U + (I_1 + I_2 + ... + I_P)/P.

Write a program that finds the negidealness of the given results table.

Вхідні дані

The input file contains a contest results table in plain ASCII. The only whitespace symbol in the table is a space. There is always at least one space separating columns. The problems are named with capital English letters in the alphabetical order. There are at most 26 problems and at most 300 teams.

Вихідні дані

The output data should contain the penalties for each criterion (values V, O, E, U, I_1, ..., I_P) and the total negidealness. All the real numbers should be precise up to 3 digits after the decimal point.

Приклад

Вхідні дані #1
   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
Вихідні дані #1
Vainness = 0.16666666666666666
Oversimplification = 0.0
Evenness = 0.2
Unsolvability = 0.2
Instability 1 = 0.0
Instability 2 = 0.3333333333333333
Instability 3 = 0.0
Instability 4 = 0.3333333333333333
Instability 5 = 0.0
Negidealness = 1.022
Автор D.Shtukenberg, G.Korneev