P1051 [NOIP 2005 Senior] Who Got the Most Scholarship Money
Description
It is customary at this school to award scholarships after each semester’s final exams. There are five types of scholarships, each with different requirements:
1. Academician Scholarship: $8000$ yuan per person. Students whose final average score is greater than $80$ ($>80$) and who have published $1$ or more papers during this semester are eligible.
2. May Fourth Scholarship: $4000$ yuan per person. Students whose final average score is greater than $85$ ($>85$) and whose class evaluation score is greater than $80$ ($>80$) are eligible.
3. Outstanding Performance Award: $2000$ yuan per person. Students whose final average score is greater than $90$ ($>90$) are eligible.
4. Western Scholarship: $1000$ yuan per person. Students from western provinces whose final average score is greater than $85$ ($>85$) are eligible.
5. Class Contribution Award: $850$ yuan per person. Student cadres whose class evaluation score is greater than $80$ ($>80$) are eligible.
As long as the conditions are met, the scholarship will be awarded. There is no limit on the number of recipients for each scholarship, and each student may receive multiple scholarships simultaneously. For example, if Yao Lin’s final average score is $87$ and the class evaluation score is $82$, and he is also a student cadre, then he can receive both the May Fourth Scholarship and the Class Contribution Award, for a total of $4850$ yuan.
Now, given data for several students, calculate which student(s) received the highest total amount of scholarship money (assume there is always at least one student who meets some scholarship condition).
Input Format
The first line contains $1$ integer $N$, the total number of students.
Each of the following $N$ lines contains one student’s data, in order: name, final average score, class evaluation score, whether the student is a student cadre, whether the student is from a western province, and the number of published papers. The name is a string of uppercase and lowercase English letters with length at most $20$ (no spaces). The final average score and the class evaluation score are integers between $0$ and $100$ (inclusive). Whether the student is a student cadre and whether the student is from a western province are each represented by $1$ character: $\tt Y$ means yes, and $\tt N$ means no. The number of published papers is an integer between $0$ and $10$ (inclusive). Each pair of adjacent data items is separated by a single space.
Output Format
Output $3$ lines.
- Line $1$: the name of the student who received the most scholarship money. If two or more students tie for the most, output the one who appears earliest in the input.
- Line $2$: the total amount of scholarship money this student received.
- Line $3$: the total amount of scholarship money received by all $N$ students.
Explanation/Hint
Constraints
For $100\%$ of the testdata, $1 \le N \le 100$.
Problem Source
NOIP 2005 Senior, Problem 1.
Translated by ChatGPT 5