#P6363. [传智杯 #2 初赛] 软件工程实习
[传智杯 #2 初赛] 软件工程实习
Description
A university’s required course “Software Engineering” is divided into a theory part and a practice part. The theory part is taught by professors at the university. The practice part is led by a third-party company: students need to learn HTML, css, JavaScript, vue, Python, django, and other technologies by themselves within five weeks, and form teams to complete a real internet business application.
There are students taking this course. They are divided into no more than teams, and each team is represented by a letter from A to Z. Each team completes a project and, as a team, gives scores to all teams (including their own team). The scores are integers from to .
To calm students’ dissatisfaction caused by many issues of this course (such as too much workload, overly tight schedule, unfair assessment method, etc.), the teacher decides to use a method that “looks” fair to determine each team’s project score:
For a given team, first compute the average of all scores given to this team by all teams (including itself). Then remove the scores that differ from this average by more than points (it is guaranteed that not all scores will be removed). Finally, compute the average of the remaining scores, round it to the nearest integer, and use it as the team’s project score.
For each student, we already know their team code and theory score (also an integer from to ). The student’s final score is of the theory score plus of the project score of their team, then rounded to the nearest integer.
Now the teacher wants to know the ranking of all students’ scores. Please output each student’s score and their team, in descending order of final score.
Input Format
The first line contains two integers and , representing the number of students and the number of teams.
The next lines each contain an integer and an uppercase letter , representing the theory score of the -th student and their team ID. It is guaranteed that the team IDs are among the consecutive letters starting from A.
The next lines each contain integers. The integer in row and column represents the score given by team to team . When , it is the self-score.
Output Format
Output lines as the answer. Students with higher scores should be output first. If scores are the same, students with a smaller team ID should be output first. For each line, first output the student’s score, then output the uppercase letter representing their team ID.
6 3
70 A
80 A
65 B
95 B
85 C
90 C
70 90 100
95 88 85
30 47 100
93 B
92 C
89 C
76 A
75 B
70 A
Hint
The scores received by team A are . Their average is , so are removed as invalid scores. Therefore, team A’s project score is .
The scores received by team B are . Their average is , so is removed as an invalid score. Therefore, team B’s project score is .
The scores received by team C are . Their average is , so no score is removed. Therefore, team C’s project score is .
Translated by ChatGPT 5
京公网安备 11011102002149号