Задачи
Ideal Contest
Ideal Contest
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 \textit{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).
\textit{Vainness penalty} \textbf{V}. Each team should solve at least one problem. If a team solves no problems, a penalty of \textbf{1/T} (where \textbf{T} is the number of teams that participated in the contest) for each such team is added.
\textit{Oversimplification penalty} \textbf{O}. There should be no team with all the problems solved. If some teams solve all the problems, a penalty of \textbf{1/T} is added for each such team.
\textit{Evenness penalty} \textbf{E}. 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 \textbf{1}, then the penalty of \textbf{1/P} (where \textbf{P} is the total number of problems) is added for each skipped number of problems solved. E.g., if a team solves \textbf{5} problems, and the next team solves \textbf{1} problem, then the penalty of \textbf{3/P} should be added, since no team solved \textbf{2}, \textbf{3} or \textbf{4} problems.
\textit{Unsolvability penalty} \textbf{U}. Every problem should be solved by at least one team. If a problem is not solved, a penalty of \textbf{1/P} for each such problem is added.
\textit{Instability penalties} \textbf{I_1}, \textbf{I_2}, ..., \textbf{I_P}. If a problem \textbf{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 \textbf{p} ranked above the lowest-ranked team that did solve problem \textbf{p} a penalty of \textbf{1/T} is added to \textbf{I_p}.
The \textit{total negidealness} \textbf{N} equals \textbf{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.
\InputFile
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 \textbf{26} problems and at most \textbf{300} teams.
\OutputFile
The output data should contain the penalties for each criterion (values \textbf{V}, \textbf{O}, \textbf{E}, \textbf{U}, \textbf{I_1}, ..., \textbf{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