#C6718. Student Records Processing
Student Records Processing
Student Records Processing
You are given records of students. Each record contains a student's name and their scores in three subjects: Mathematics, Physics, and Chemistry. A student is said to have passed if they have scored at least 35 in each subject.
Your task is to process multiple test cases. For each test case, you need to output the names of the students who have passed all subjects. The names should be sorted primarily by their total score in descending order. In case of a tie, sort the names in alphabetical order.
Note: If no student passes in a test case, output an empty line for that test case.
The total score is defined as:
\( T = \text{Mathematics} + \text{Physics} + \text{Chemistry} \)
inputFormat
The input is read from standard input (stdin) and has the following format:
- An integer \( T \) representing the number of test cases.
- For each test case:
- An integer \( n \) denoting the number of student records.
- \( n \) lines follow, each containing a student's record in the format:
Name Mathematics Physics Chemistry
. Each field is separated by a space.
outputFormat
For each test case, print a single line with the names of the students who passed, sorted by the criteria mentioned above. The names should be separated by a single space. If no student passes, print an empty line.
The output is written to standard output (stdout).
## sample5
3
John 78 67 90
Alice 45 50 49
Bob 34 80 90
4
Rachel 55 89 76
Monica 90 92 85
Phoebe 28 64 72
Chandler 30 29 101
3
John 60 60 60
Alice 60 60 60
Bob 35 35 35
3
John 30 60 60
Alice 60 34 60
Bob 35 35 30
5
Harry 90 90 90
Ron 85 85 85
Hermione 100 100 100
Neville 30 40 35
Luna 35 35 35
John Alice
Monica Rachel
Alice John Bob
Hermione Harry Ron Luna
</p>