Pure StorageOA #14
Racing Results
Estimated EasyJudge-ready
Topics (AI-labelled)HashingSimulation
Accumulate scores from the (race, racer_id, position) records of the races. Positions 1..6 earn 10, 6, 4, 3, 2, 1 points respectively, and any other position earns 0 points. The racer with the highest total wins; on a tie, the smallest racer_id wins.
Input
The first line contains R M, where R is the number of racers and M is the number of result records; each of the next M lines is race racer_id position. Added by this site: 1≤R≤100, 0≤M≤10000, race∈[2001,2100], racer IDs are consecutive, 1001..1000+R; each (race,racer_id) has at most one record, and position∈[1,R]. Racers who do not appear in any record are ranked with 0 points.
Output
Output the winner's ID and total score, separated by a space.
Example 1
Input:
3 6
2001 1001 3
2001 1002 2
2002 1003 1
2002 1001 2
2002 1002 3
2001 1003 1
Output:
1003 20
Example 2
Input:
8 1
2001 1002 8
Output:
1001 0
Example 3
Input:
6 1
2001 1002 6
Output:
1002 1
Editorial
Loading solution…