#C13937. Top Student Selection
Top Student Selection
Top Student Selection
You are given a list of students with their scores. Your task is to determine the student with the highest score.
If there is a tie, the student who appears first in the input order should be selected. If the list is empty, output None
.
More formally, if there are n students, then for each student i (1 ≤ i ≤ n) described by a name and score, you need to output the student name such that:
\[ score = \max_{1 \leq i \leq n}\{score_i\} \]and if multiple students achieve this maximum score, choose the one which appears first in the input.
inputFormat
The input is read from stdin and has the following format:
- The first line contains an integer n (n ≥ 0), the number of students.
- Then follow n lines. Each of these lines contains a student's name (a string without spaces) and an integer score, separated by space.
outputFormat
Output the name of the top student to stdout. If the list is empty (n = 0), output None
.
1
Alice 88
Alice