2.4 Dhrumil's : Formula 1 🏎️
There are n racers racing for the Formula 1 Championship Trophy
But the program calculating the winner of the championship is broken
Hence u need to help them by writing an algorithm
These racers race for m races, for each race you get n lines, containing the race data
You are given 3 things, Driver Name, Driver Time and Driver Penalty
suppose,
Example
n = 5, m = 1
VER 53 0
HAM 54 5
LEC 57 0
SAI 60 0
NOR 61 0
Here, VER is the driver name who has taken 53 seconds to complete the race and he has no time penalties, Whereas HAM has a penalty of 5 seconds for almost killing VER
So after adding the penalties, HAM drops to 3rd with total time of 59 seconds
For each race, Winner gets 25 pts, Second gets 18 pts, Third gets 15 pts
If two people have same time, the one which came first in input order wins
Your job is to find the Championship winner and the number of pts he has.
Constraints
Driver Name Length <= 10
T <= 100
n = 100, m = 25
Input Format
t : The first line indicates that there is 1 test case.
n : The second line specifies that there are 5 drivers in the race.
m : The second line also specifies that there are 2 laps in the race.
Output Format
The output should list the total points of the winner of the championship and their respective name.
Example 1
Input:
1
5 2
VER 50 5
HAM 52 5
SAI 54 5
LEC 56 5
NOR 57 0
VER 58 1
HAM 59 2
LEC 58 4
SAI 60 0
NOR 60 1
Output:
50 VER
Explanation:
It is guaranteed there is one distinct championship winner
Log In to solve the Question