#309
Bronze IV
Don't Be Last!
시간 제한
2s
메모리 제한
1024MB
제출
8
정답
2
맞힌 사람
2
정답 비율
25.0%

문제

Farmer John owns 7 dairy cows: Bessie, Elsie, Daisy, Gertie, Annabelle, Maggie, and Henrietta. He milks them every day and keeps detailed records on the amount of milk provided by each cow during each milking session. Not surprisingly, Farmer John highly prizes cows that provide large amounts of milk.

Cows, being lazy creatures, don't necessarily want to be responsible for producing too much milk. If it were up to them, they would each be perfectly content to be the lowest-producing cow in the entire herd. However, they keep hearing Farmer John mentioning the phrase "farm to table" with his human friends, and while they don't quite understand what this means, they have a suspicion that it actually may not be the best idea to be the cow producing the least amount of milk. Instead, they figure it's safer to be in the position of producing the second-smallest amount of milk in the herd. Please help the cows figure out which of them currently occupies this desirable position.

입력

The input file for this task starts with a line containing the integer NN (1N1001 \leq N \leq 100), giving the number of entries in Farmer John's milking log.

Each of the NN following lines contains the name of a cow (one of the seven above) followed by a positive integer (at most 100), indicating the amount of milk produced by the cow during one of its milking sessions.

Any cow that does not appear in the log at all is assumed to have produced no milk.

출력

On a single line of output, please print the name of the cow that produces the second-smallest amount of milk. More precisely, if MM is the minimum total amount of milk produced by any cow, please output the name of the cow whose total production is minimal among all cows that produce more than MM units of milk. If several cows tie for this designation, or if no cow has this designation (i.e., if all cows have production equal to MM), please output the word "Tie". Don't forget to add a newline character at the end of your line of output. Note that M=0M=0 if one of the seven cows is completely absent from the milking log, since this cow would have produced no milk.

예제 입력 1

10
Bessie 1
Maggie 13
Elsie 3
Elsie 4
Henrietta 4
Gertie 12
Daisy 7
Annabelle 10
Bessie 6
Henrietta 5

예제 출력 1

Henrietta
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
#순위사용자언어시간메모리코드 길이
5646🥇
최정민
Python8ms8396KB442B
8599🥈
고수아
Python8ms8444KB668B
난이도 투표
Bronze IV1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
#사용자문제결과언어시간메모리코드 길이제출 시간
8599
맞았습니다
Python8ms8444KB668B2026. 05. 30. 10:49
8598
틀렸습니다
Python--674B2026. 05. 30. 10:48
8597
런타임 에러
Python--678B2026. 05. 30. 10:47
8596
틀렸습니다
Python--500B2026. 05. 30. 10:44
8595
틀렸습니다
Python--293B2026. 05. 30. 10:23
5646
맞았습니다
Python8ms8396KB442B2026. 04. 28. 04:31
5645
틀렸습니다
Python--441B2026. 04. 28. 04:28
5644
틀렸습니다
Python--434B2026. 04. 28. 04:17