#K92927. Highest Ranked Athlete
Highest Ranked Athlete
Highest Ranked Athlete
You are given a competition with n athletes and m events. Each athlete may earn a score in an event. You are provided with k records, each record being a triplet (athlete, event, score).
The total score for athlete \( i \) is computed as:
\( S_i = \sum_{j=1}^{m} s_{ij} \)
Your task is to determine the athlete with the highest total score. In case of a tie, choose the athlete with the smallest number.
If there are no score records, output the athlete number 1 with a total score of 0.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains two integers n and m, representing the number of athletes and the number of events respectively.
- The second line contains an integer k, the number of score records.
- The next k lines each contain three integers separated by spaces: the athlete number, the event number, and the score obtained.
outputFormat
Print to standard output (stdout) two integers separated by a space: the athlete number with the highest total score and their corresponding total score.
## sample3 3
9
1 1 10
2 1 20
3 1 15
1 2 25
2 2 35
3 2 30
1 3 40
2 3 30
3 3 35
2 85