Woburn Challenge 2016-17 Round 2 - Junior Division

Problem 1: The Perfect Mate

Lieutenant B'Elenne Terres is one unsatisfied Klingon. Her engineering working aboard the Starship Enterprise is all well and good, but what she really needs is a mate!

Fortunately for her, the Enterprise has happened across a Klingon colony, which has N (1 ≤ N ≤ 100) warriors living there. The i-th warrior's name is Si (a unique string consisting of at most 20 letters), and according to a survey which Terres has conducted, they've won Wi (0 ≤ Wi ≤ 100) battles and lost Li (0 ≤ Li ≤ 100) battles in their lifetime. She's not too concerned about which of the warriors actually happen to be single at the time.

Any warrior who has lost at least one battle would clearly not make a suitable mate – weakness is unacceptable. Of the warriors who have never lost any battles, the perfect mate is the one who has won the greatest number of battles. If multiple suitable warriors have won the same number of battles, then the one earliest in the list of N warriors is preferable.

Please help Terres determine the name of this perfect mate! Of course, it's also possible that there's no such mate, if none of the N warriors are suitable.

Input Format

The first line of input consists of a single integer N.
N lines follow, with the i-th of these lines consisting of a single string Si, followed by a space, followed by two space-separated integers Wi and Li (for i = 1..N).

Output Format

Output a single line consisting of a single string – either the name of the perfect mate, or "None" if there are no suitable mates.

Sample Input 1

Mereg 7 0
Werf 15 10
Kehless 14 0
Kerek 14 0
Stex 2 3

Sample Output 1


Sample Input 2

Jacob 100 1

Sample Output 2


All Submissions
Best Solutions

Point Value: 5
Time Limit: 2.00s
Memory Limit: 16M
Added: Dec 11, 2016
Author: SourSpinach

Languages Allowed:

Comments (Search)

Sample imputs are working and i still get 2 WAs on submit

Just to help you, I think it would be better to solve it case by case, instead of using arrays

Ré ber, people can à have zero wins, so you should set you most win as negative one