#P13944. [EC Final 2019] Happiness
[EC Final 2019] Happiness
题目描述
has graduated from college years and he really misses the time he spent with ICPC(Interspecies Collegiate Pokemon Camp).
There are problems in one contest in ICPC. participating teams have minutes to solve them. After the contest, teams are ranked according to the most problems solved. Teams who solve the same number of problems are ranked by least total time. The total time is the sum of the time consumed for each problem solved. The time consumed for a solved problem is the time elapsed from the beginning of the contest to the submittal of the first accepted run plus 20 penalty minutes for every previously rejected run for that problem. There is no time consumed for a problem that is not solved. If two teams tie, their s are calculated. A team's solution time list is a list consisting of solution times of all problems solved by that team, sorted in descending order. The solution time of one problem is the time elapsed from the beginning of the contest to the submittal of the first accepted run of that problem. (We do not add a penalty for the solution time.) The team with a lexicographically smaller solution time list has a better rank. A list is lexicographically smaller than if there exists an integer such that and for all integers . If teams still tie, 's team is assumed to have a better rank.
After determining the rank, prizes will be awarded. Initially, a team with rank will get happiness. Then medals are awarded: Teams with rank to are awarded gold medal. The of receiving a gold medal is . Teams with rank to are awarded silver medal. The of receiving a silver medal is . Teams with rank to are awarded bronze medal. The of receiving a bronze medal is . In addition to medals, for each problem, the team solved it first gets happiness. The team with at least one solution and the smallest solution time overall teams and all problems gets an extra happiness. The team with at least one solution and the largest solution time overall teams and all problems gets an extra happiness. In the case of a tie, 's team can always get happiness.
There were teams in a contest participated. He remembers all the submissions (time and verdict) of all other teams. For each problem, he also remembers if he knew the solution to that problem and the number of rejected runs and times he needed to solve it.
If solved problems in the wisest order, what is the maximum happiness he could get? Note that cannot solve any problem after minutes from the beginning of the contest (He can solve problems at exactly 300 minutes). Once solves a problem, he needs to submit it immediately and solve another one. He can't postpone his submission to get the last submission happiness.
输入格式
The first line contains an integer denoting the number of teams (, is a multiple of ).
Each of the next lines describes one team and contains the statuses of the problems. For each problem, if it is not solved by the team, the status contains a single character -
. Otherwise, the status contains two integers and separated by a single space denoting the solution time and the number of rejected runs before the solution time (). Statuses of different problems are separated by ,
.
The last line describes 's team. For each problem, if did not know how to solve it, the status contains a single character -
. Otherwise, the status contains two integers and separated by a single space denoting the required time and the number of rejected runs before could solve it (). Statuses of different problems are separated by ,
.
There are no extra spaces and other characters in the statuses of and other teams.
输出格式
Output one integer --- the maximum happiness.
10
233 1,-,-,7 7,257 4,173 5,117 1,-,-,85 3
-,231 0,167 0,257 7,-,-,122 4,283 0,215 4,-
41 1,-,290 8,-,-,-,-,246 7,120 3,184 9
142 8,243 7,69 0,-,41 9,-,279 1,264 4,-,74 9
53 8,-,187 9,60 1,48 8,99 10,-,-,55 7,259 5
250 0,-,-,-,166 0,16 3,-,82 4,73 0,184 3
-,-,-,-,105 3,-,-,-,152 4,-
-,84 5,98 8,-,120 8,241 3,94 1,-,28 7,109 8
280 6,246 5,58 9,-,-,-,-,-,-,-
38 10,-,227 10,187 9,182 1,-,203 9,254 7,-,-
1800