#TCTM6135. Silent Auction

0
    ID: 1666 传统题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>6135循环结构结构体排序基础Junior(初级组)CCC 2021简单

Silent Auction

Silent Auction

题目描述

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. 一家慈善机构正在进行一场拍卖,人们在不知道其他人出价的情况下对奖品进行出价。每份投标书都包括一个人的名字和他们的投标金额。拍卖结束后,出价最高的人就是赢家。如果出现平局,最先出价的人获胜。你的工作是确定拍卖的获胜者。

输入格式

The first line of input contains a positive integer N, where 1 ≤ N ≤ 100, representing the number of bids collected at the silent auction. Each of the next N 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.

第一行输入包含一个正整数 NN,其中 1≤N≤1001≤N≤100,表示在拍卖中收集的投标数量。 接下来的 NN 行.每一行都包含一个人的名字,在下一行包含他们的出价金额,单位为美元。每个出价都是一个小于 20002000 的正整数。输入的顺序是投标的顺序。

输出格式

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

输出赢得拍卖的人的姓名。

3
Ahmed
300
Suzanne
500
Ivona
450
Suzanne
2
Ijeoma
20
Goor
20
Ijeoma

提示

#### 数据范围与提示 $1≤N≤100$ Explanation of Output for Sample Input 1 The highest bid placed was 500 and it was placed by Suzanne. Suzanne wins the silent auction. Explanation of Output for Sample Input 2 The highest bid placed was 20 and it was placed by both Ijeoma and Goor. Since Ijeoma’s bid was placed first, Ijeoma wins the silent auction.

来源

童程童美