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

5294번 - Pirates On Parade 다국어

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

문제

Davy Jones wants his men to line up on parade. The men are to line up in pairs, from shortest to tallest. However, two pirates in the same pair can only differ in height by at most 2 inches. You start lining up the pirates in pairs in order, starting with the shortest pirate. If after selecting a pirate it is not possible to find a pirate sufficiently near his height (or if there are no pirates left), the unpaired pirate will be forced to walk the plank! You may assume no pirates are exactly the same height.

입력

The input will be a list of pirates listed by name and their height in inches as an integer.

출력

The output should be the names of pairs of pirates, each on a single line, in order from shortest to tallest. The shorter pirate in each pair should be first. Any pirates forced to walk the plank should not be listed.

제한

예제 입력 1

Sam 60
Dan 52
Bob 54
Art 61

예제 출력 1

Dan Bob
Sam Art

예제 입력 2

Sam 60
Dan 52
Bob 54
Kim 70
Art 61

예제 출력 2

Dan Bob
Sam Art

힌트

출처

School > University of Maryland High School Programming Contest > HSPC 2007 3번

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

출처

대학교 대회

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

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