#C8563. Finding the Hardest Worker
Finding the Hardest Worker
Finding the Hardest Worker
You are given the working hours of several employees over a period. For each employee, the working hours for individual days are provided. Your task is to determine the employee who has worked the most total hours. If there is a tie (i.e. multiple employees have the same total working hours), return the name that comes first in lexicographical order.
The total working hours \(T\) for an employee is calculated as:
\[ T = \sum_{i=1}^{n} h_i \]where \(h_i\) represents the number of hours worked on day \(i\).
inputFormat
The input starts with an integer \(N\) denoting the number of employees. For each employee, there are two lines:
- The first line contains the employee's name (a string without spaces) followed by an integer \(M\) indicating the number of days.
- The second line contains \(M\) space-separated integers, each representing the number of hours worked on that day.
outputFormat
Output a single line containing the name of the employee with the maximum total working hours. In case of a tie, output the lexicographically smallest name.
## sample3
Alice 7
6 7 8 8 8 9 6
Bob 7
5 6 6 9 7 8 7
Charlie 7
8 8 8 8 8 8 4
Alice