问题1465--Programming Contest Ranking

1465: Programming Contest Ranking

时间限制: 1 Sec  内存限制: 128 MB
提交: 3  解决: 0
[状态] [讨论版] [提交] [命题人:]
题目描述
  Heilongjiang Programming Contest will end successfully! And your task is programming contest ranking.
The following rules rankings:
      1.A problem is solved when it is accepted by the judges.
      2.Teams are ranked according to the most problems solved;
      3.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 accepted run plus 20 penalty minutes for every rejected run for that problem regardless of submittal time. Team(s) who firstly solved the problem will have no penalty in the problem. There is no time consumed for a problem that is not solved.
      4.Teams who are the same number of problems solved and the same total time are ranked by the most weighting number of problems solved;The weight of the i-th problem is the floor of N/Ci. where N is the number of all teams, and Ci is the number of teams who solved the i-th problem. The weight of one problem will be 0 if there is no team solved the problem.

输入
 The input contains multiple test cases. For each test case,first line contains two integers,N and M,N (1 < N <=200) is the number of all teams,M (6 <= M <=20) is the number of problems;
   Then following N lines, there are M+1 items seprated by a space in each.line, corresponding the record of one team . The first item is the name of the team, not exceed 20 letters. Then following M items, each item is:
  1. -\-    if the team did not submit for the problem;
  2. TT\-  if the team submitted TT times for the problem,but did not solve it.
  3. TT\FT if the team submitted TT times for the problem, FT is the time elapsed from the beginning of the contest to the submittal of the accepted.
  1 <= TT <= 32, 1 <= FT<=300, Both TT and FT are integer.

输出
Output ranking result in N lines.
The format of each line is:
   Rank (width 3)  
Name of team (width 20)
Number of problems solved (width 2)
Total time(width 6)
Weighting Number of problems solved (width 4)
   Each item above align right, seprated by a space.

样例输入 Copy
6 6
Leifeng 8\135 1\20 1\57 5\230 6\- 3\283
Fighter 7\136 1\15 1\42 6\200 5\- 2\270
AlwaysAK 7\156 1\24 1\31 5\202 5\270 4\- 
SoyOnceMore 5\- 6\- 3\- 2\75 -\- -\-
RpRpRp 5\- 3\35 10\- -\- -\- -\-
StartAcm 2\- 3\- 3\- 4\- 1\- -\-
样例输出 Copy
  1              Leifeng  5    845    9
  2             AlwaysAK  5    883   12
  3              Fighter  5    883    9
  4               RpRpRp  1     75    1
  4          SoyOnceMore  1     75    1
  6             StartAcm  0      0    0
提示
In the sample, though team Leifeng submitted 8 times for problem A, but they firstly solved problem A, so the time consumed of problem A is 135, not 275.
来源/分类