A cab company has the list of cab rides after it gets completed. After the journey both cab driver and ride taker provide rating to each other. Rating can be from 1 to 5 where 5 is the best rating and 1 being the worst. Given a Rider taker name, find the eligible cab drivers for him based on the historical data that is being given to you. The criteria are given below to choose the eligible cab drivers –
- Average rating of Cab driver should be greater than average rating of ride taker (Choose with the highest rating).
- If no cab driver is found, then consider the best of all of them.
- If any cab driver has provided 1 rating to a ride taker or vice versa then they are not allowed to do a ride together.
Ex: Input
Ride data is given {Ride Taker Name, Rating given to Ride Taker, Driver Name, Rating
given to driver}
Ride 1 – {Ram, 3, Bheem, 5}
Ride 2 – {Laxman, 5, Nakul, 2}
Ride 3 – {Ram, 4, Sahadev, 2}
Ride 4 – {Bharat, 3, Bheem, 5}
Ride 5 – {Ram, 3, Bheem, 1}
Ride 6 – {Laxman, 5, Sahadev, 3}
Ride 7 – {Bharat, 5, Nakul, 5}
Find eligible drivers for:
Eg:
1. Ram
2. Laxman
Output:
1. Nakul
2. Bheem
You are given an input integer N which is the number of teams in a cricket tournament. For each team, first, you will be given with Team Name and then K, which is the number of players in that team. Now next K lines contain playerNames. The team will then be provided with total points
Your job is to print the name of first-team on the leaderboard.
Ex: Input
3
INDIA 4
VIRAT
DHONI
SEHWAG
BHAJJI
1
AUSTRALIA 3
PONTING
SYMONDS
SMITH
3
ENGLAND 2
MORGAN
BUTLER
2
Output: AUSTRALIA