Logo
(追記) (追記ここまで)

9952번 - Bree's pantry 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB76544573.770%

문제

Those who watch "Desperate Housewives" will have encountered Bree, who is an obsessive compulsive. She likes to keep her cans in order in her pantry — tallest in the middle, next tallest to the left of the middle one, next tallest to the right of the middle one and so on. Her tins are all labelled with a 3 letter code to show their contents, such as "TOM" for tomatoes, or "swc" for sweet corn. If two or more cans have equal heights, she considers cans that are labelled the lowest alphabetically (ignoring case) to be the tallest.

입력

Input consists of a series of scenarios, terminated by a line containing a single zero (0). Each scenario begins with a line containing the number of cans to be arranged (n, 1 ≤ n ≤ 20). This line is followed by n lines each representing one can, denoted by a 3 letter code, a space, and a positive integer specifying the height of the can in centimetres.

출력

Output for each scenario will be a single line, the codes from the cans in the order, from left to right, that they will appear in Bree's pantry. The case for each code must be the same as it was on input.

제한

예제 입력 1

5
TOM 12
Veg 10
SPG 15
XXX 9
swc 10
3
Alm 8
SAL 6
Tna 5
0

예제 출력 1

Veg TOM SPG swc XXX
SAL Alm Tna

힌트

출처

ICPC > Regionals > South Pacific > South Pacific Region > New Zealand Programming Contest > NZPC 2007 F번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /