問題一覧 > 通常問題

No.1045 Cuboid University

レベル : / AI推定難易度 : 1550 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 116
作問者 : Suunn / テスター : xenon_motsu
お気に入りにしたユーザー ProblemId : 3622 / 自分の提出
問題文最終更新日: 2020-05-01 21:30:35
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 246 (順位表) の他の問題:

Problem Statement

Takahashi is a student at Cuboid University (abbreviated: Chokudai).

It is graduation project season at Cuboid University. There is a rumor that anyone at this university who cuts even the slightest corner on their graduation project will be held back a year, so Takahashi wants to make something as good as possible.

Takahashi has decided to build a monument by stacking the $N$ rectangular cuboids he collected in advance for his graduation project. The lengths of the $3$ edges of the $i$-th cuboid are $A_i,B_i,C_i$. The monument must satisfy the following conditions: only one cuboid, that is, exactly $1$ cuboid, may be stacked in direct contact with the top face of any $1$ cuboid; a cuboid whose length or width is larger than that of the cuboid below it must not be stacked on top; and the upper cuboid must be placed so that it has an edge parallel to either the length edge or the width edge of the cuboid below it. Conversely, as long as the above conditions are satisfied, the cuboids may be stacked in any way, and each cuboid may be used in any orientation, assigning its $3$ edges to length, width, and height in any way.

The goodness of a monument is equal to its height. Find the goodness of the best monument Takahashi can build.

(Added at 21:29: You do not need to use all of the cuboids. It is fine to use only 1 cuboid.)

Input

$N$
$A_1\ B_1\ C_1$
$A_2\ B_2\ C_2$
$\vdots$
$A_N\ B_N\ C_N$

$1 \le N \le 16$
$1 \le A_i,B_i,C_i \le 10^7$
All input values are integers.

Output

Output the maximum goodness of a monument Takahashi can build.

Sample

Sample 1
Input
1
1 2 3
Output
3

It is best to place the cuboid in the orientation where the edge of length $3$ is the height.

Sample 2
Input
2
2 7 3
5 1 4
Output
8

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。