## CCC '21 J2 - Silent Auction

View as PDF

Points: 3 (partial)
Time limit: 3.0s
Memory limit: 1G

Problem type
##### Canadian Computing Competition: 2021 Stage 1, Junior #2

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 Specification

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 . The order of the input is the order in which bids were placed.

#### Output Specification

Output the name of the person who has won the silent auction.

#### Sample Input 1

3
Ahmed
300
Suzanne
500
Ivona
450

#### Output for Sample Input 1

Suzanne

#### Explanation of Output for Sample Input 1

The highest bid placed was and it was placed by Suzanne. Suzanne wins the silent auction.

#### Sample Input 2

2
Ijeoma
20
Goor
20

#### Output for Sample Input 2

Ijeoma

#### Explanation of Output for Sample Input 2

The highest bid placed was and it was placed by both Ijeoma and Goor. Since Ijeoma's bid was placed first, Ijeoma wins the silent auction.

## Comments

• commented on April 26, 2021, 1:24 p.m.

this question is confusing

• commented on April 26, 2021, 2:24 p.m.

Instructions are very simple: you get the input for all the bids and output the person with the highest bid. If there are 2 or more bids that are tied for highest, output the person that came first with the highest bid.

For the first sample, there are 3 bids: Ahmed with 300, Suzanne with 500 and Ivona with 450. Therefor Suzanne would have won because she placed the highest bid.

Hope this helped :)