Problem
All-around events (of M
sports) include N
athletes (\(N < 1000\)< /span>) . The input to the program in the first line is the number of athletes N
, in the second – number of sports M
. Each of the following N
lines contains information in the following format:
<Lastname> <Name> <Points>
,
where <Lastname> – a string of no more than 20 characters without spaces;
- <Name> – a string of no more than 12 characters without spaces;
- <Points> – M integers denoting the number of points scored by an athlete in each of the all-around events.
<Lastname> and <Name>, <Name> and <Points>, as well as individual numbers in the <Points>
field are separated by exactly one space.
Example input lines:
3
4
Ivanov Sergey 100 30 78 13
Petrov Anton 90 16 98 14
Sidorov Yury 100 70 30 21
The program should output a resulting table containing a list of athletes sorted in descending order of points, totals scored and places taken.
In this case, the program should output:
Ivanov Sergey 221 1
Sidorov Yury 221 1
Petrov Anton 218 2