Silent Auction
InterviewTime limit1sMemory limit1024 MB
Given bids in the order they were placed, print the name of the highest bidder, breaking ties in favor of the earliest bid.
- Level
Easy2 of 10
- Topics
- Array, Implementation
- Solved
- No attempts yet
Problem
A charity is having a silent auction where people place bids on a prize without knowing anyone else's bid. Each bid includes a person's name and the amount of their bid. After the silent auction is over, the winner is the person who has placed the highest bid. If there is a tie, the person whose bid was placed first wins. Your job is to determine the winner of the silent auction.
Input
The first line of input contains a positive integer , where , representing the number of bids collected at the silent auction. Each of the next pairs of lines contains a person's name on one line, and the amount of their bid, in dollars, on the next line. Each bid is a positive integer less than 2000. The order of the input is the order in which bids were placed.
Output
Output the name of the person who has won the silent auction.