The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 4 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
The NCC judge is down and you are given the responsibility of ranking the contestants.
You are given the list of submissions of the entire contest. For each submission, a single line consisting of Player Name, Question No. and Submission Points will be given.
You have to rank the players and print the name of player who is at rank r.
Questions numbers are numbered 1-indexed.
Some rules that are to be followed are given below:
Rules:
Note:
There is no test case where the no. of submissions and the score of more
than 1 players are both equal.
Input:
The first line will consist the total number of players(p), total submissions(s), total
questions(q) and max achievable score for questions(m)(Maximum achievable score for all the questions is same) all separated by space.
Next line will contain r. It will be followed by s lines consisting the player name,question number and points (separated by space) scored in that question. Player name will be a string of not more than 25 characters.
Output:
Output the name of player at rth rank on a single line.
Constraints:
1 p
1 s 7
1 q
1 m
1 r
Sample test case:
#1
Input:
4 18 7 7
1
a 1 7
b 3 6
b 2 5
c 4 7
d 1 6
d 2 5
d 1 6
a 1 6
b 7 3
c 7 3
c 6 7
a 3 6
a 2 5
b 2 5
c 4 6
d 6 7
d 6 6
b 3 5
Output:
a
Explaination:
Here the scores are:
a-->18
b-->14
c-->17
d-->18
We have to find first ranked player,but here there is tie between 'a' and 'd' , but total no. of
submissions are less for 'a', so 'a' is ranked first and 'b' second.
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll