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

9165번 - Nested Shrubbery Boxes 다국어

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

문제

After each commission to install a shrubbery, Roger the Shrubber has to transport many empty planting boxes with a drawn cart. In this instance, a planting box is a wooden box with one open side.

Given a set of n planting boxes, compute the largest number of boxes that can be nested. Specifically, report the number of the largest subset of boxes which may be nested such that the smallest box of the subset fits within the second smallest, the second smallest of the subset fits within the third smallest, the third smallest of the subset fits within the fourth smallest, and so forth.

A box i (bi) fits into box j (bj) if there exists some rotation of bi such that each dimension of bi is less than the corresponding dimension of bj. Any box can be rotated to nest inside another box.

입력

The input will consist of an unspecified number of box sets. Each set will begin with a line containing n, 0 ≤ n ≤ 500, the number of boxes in the set. Each box will be described on its own line by three positive integers representing length, width and height (Each value will not exceed 1000). The first two numbers of each box description will be followed by a space, the letter ‘x’, and a space. The end of input occurs when n = -1.

출력

For each set of boxes, print a line containing the largest number of boxes that can be selected from the original set to form a fully nesting subset of boxes.

제한

예제 입력 1

5
145 x 472 x 812
827 x 133 x 549
381 x 371 x 900
271 x 389 x 128
718 x 217 x 491
4
432 x 123 x 139
942 x 844 x 783
481 x 487 x 577
677 x 581 x 701
-1

예제 출력 1

2
4

힌트

출처

ICPC > Regionals > North America > Pacific Northwest Regional > 2006 Pacific Northwest Region Programming Contest G번

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

출처

대학교 대회

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

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