当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1162:Building with Blocks

题目描述
A unit cube is a 1x1x1 cube, whose corners have integer x, y, and z coordinates. Two unit cubes are connected when they share a face. A 3-dimensional solid object (solid, for short) is a non-empty connected set of unit cubes (see Figure 1). The volume of a solid is the number of unit cubes it contains. A block is a solid with volume at most 4. Two blocks have the same type when one can be obtained from the other by translations and rotations (not reflections). There are exactly 12 block types (see Figure 2). The colors in the figures only help to clarify the structure of the solids; they have no other meaning.

A set D of blocks is a decomposition of a solid S when the union of all blocks in D equals S, and no two distinct blocks in D have a unit cube in common.

Your task is to write a program that, given a description of a solid S, determines a smallest set of blocks into which S can be decomposed. It only needs to report the types of these blocks as often as they occur in the decomposition.
输入解释
Your program is to read from standard input. The first line contains the volume V of the solid (1 <= V <= 50). The remaining V lines contain three integers x, y, z, being the coordinate triple of its corner that minimizes x + y + z, each identifying one unit cube of the solid (1 <= x, y, z <= 7).
输出解释
Your program is to write to standard output. The first line must contain one integer M, being the smallest number of blocks into which the input solid can be decomposed.
输入样例
18
2 1 1
4 1 1 
2 3 1 
4 3 1
2 1 2
3 1 2
4 1 2 
1 2 2 
2 2 2
3 2 2
4 2 2
2 3 2
3 3 2 
4 3 2
4 2 3
4 2 4
4 2 5
5 2 5
输出样例
5

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 IOI 2000

源链接: POJ-1162

最后修改于 2020-10-29T05:54:24+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 10000