Ideal Contest
Time limit1sMemory limit128 MB
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 be the number of participating teams and the number of problems.
Vainness . Every team should solve at least one problem. For each team that solves no problem, add .
Oversimplification . No team should solve every problem. For each team that solves all problems, add .
Evenness . 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 , add — one 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 is added.
Unsolvability . Every problem should be solved by at least one team. For each problem that no team solves, add .
Instability . If some team solves problem , then every team ranked above it should also solve . For problem , take the lowest-ranked team that solved ; for each team ranked strictly above that team (a strictly smaller rank number) that did not solve , add to . If no team solves , then .
The total negidealness is
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 lettersA,B, … in alphabetical order), then=,Time, andR. - 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+kif the team solved that problem (with earlier wrong attempts),-kif 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 ,Oversimplification =followed by ,Evenness =followed by ,Unsolvability =followed by ,Instability p =followed by for ,Negidealness =followed by .
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.