cswork / OA打开练习工作台

Pure StorageOA #14

Racing Results

估计简单可在线判题

考点(AI 标注)哈希计数模拟/实现

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.

输入格式

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 the winner's ID and total score, separated by a space.

样例 1

输入:

3 6
2001 1001 3
2001 1002 2
2002 1003 1
2002 1001 2
2002 1002 3
2001 1003 1

输出:

1003 20

样例 2

输入:

8 1
2001 1002 8

输出:

1001 0

样例 3

输入:

6 1
2001 1002 6

输出:

1002 1