22014_TheBulk

2022-5-16 18:21| 发布者: Hocassian| 查看: 22| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-8950641521900-Problem List-采集的数据-后羿采集器.html

Pro.ID

22014

Title

The Bulk

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22014

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/32768 K (Java/Others)
  • 描述

    ACM uses a new special technology of building its transceiver stations. This technology is called Modular Cuboid Architecture (MCA) and is covered by a patent of Lego company. All parts of the transceiver are shipped in unit blocks that have the form of cubes of exactly the same size. The cubes can be then connected to each other. The MCA is modular architecture, that means we can select preferred transceiver configuration and buy only those components we need.

    The cubes must be always connected "face-to-face", i.e. the whole side of one cube is connected to the whole side of another cube. One cube can be thus connected to at most six other units. The resulting equipment, consisting of unit cubes is called The Bulk in the communication technology slang.

    Sometimes, an old and unneeded bulk is condemned, put into a storage place, and replaced with a new one. It was recently found that ACM has many of such old bulks that just occupy space and are no longer needed. The director has decided that all such bulks must be disassembled to single pieces to save some space. Unfortunately, there is no documentation for the old bulks and nobody knows the exact number of pieces that form them. You are to write a computer program that takes the bulk description and computes the number of unit cubes.

    Each bulk is described by its faces (sides). A special X-ray based machine was constructed that is able to localise all faces of the bulk in the space, even the inner faces, because the bulk can be partially hollow (it can contain empty spaces inside). But any bulk must be connected (i.e. it cannot drop into two pieces) and composed of whole unit cubes.

    输入

    There is a single positive integer T on the first line of input. It stands for the number of bulks to follow. Each bulk description begins with a line containing single positive integer F, 6 ≤ F ≤ 250, stating the number of faces. Then there are F lines, each containing one face description. All faces of the bulk are always listed, in any order. Any face may be divided into several distinct parts and described like if it was more faces. Faces do not overlap. Every face has one inner side and one outer side. No side can be "partially inner and partially outer".

    Each face is described on a single line. The line begins with an integer number P stating the number of points that determine the face, 4 ≤ P ≤ 200. Then there are 3 × P numbers, coordinates of the points. Each point is described by three coordinates X, Y, Z (0 ≤ X, Y, Z ≤ 1000) separated by spaces. The points are separated from each other and from the number P by two space characters. These additional spaces were added to make the input more human readable. The face can be constructed by connecting the points in the specified order, plus connecting the last point with the first one.

    The face is always composed of "unit squares", that means every edge runs either in X, Y or Z-axis direction. If we take any two neighbouring points X1, Y1, Z1 and X2, Y2, Z2, then the points will always differ in exactly one of the three coordinates. I.e. it is either X1X2Y2, or Z1Z2, other two coordinates are the same. Every face lies in an orthogonal plane, i.e. exactly one coordinate is always the same for all points of the face. The face outline will never touch nor cross itself.

    输出

    Description

    ACM uses a new special technology of building its transceiver stations. This technology is called Modular Cuboid Architecture (MCA) and is covered by a patent of Lego company. All parts of the transceiver are shipped in unit blocks that have the form of cubes of exactly the same size. The cubes can be then connected to each other. The MCA is modular architecture, that means we can select preferred transceiver configuration and buy only those components we need.

    The cubes must be always connected "face-to-face", i.e. the whole side of one cube is connected to the whole side of another cube. One cube can be thus connected to at most six other units. The resulting equipment, consisting of unit cubes is called The Bulk in the communication technology slang.

    Sometimes, an old and unneeded bulk is condemned, put into a storage place, and replaced with a new one. It was recently found that ACM has many of such old bulks that just occupy space and are no longer needed. The director has decided that all such bulks must be disassembled to single pieces to save some space. Unfortunately, there is no documentation for the old bulks and nobody knows the exact number of pieces that form them. You are to write a computer program that takes the bulk description and computes the number of unit cubes.

    Each bulk is described by its faces (sides). A special X-ray based machine was constructed that is able to localise all faces of the bulk in the space, even the inner faces, because the bulk can be partially hollow (it can contain empty spaces inside). But any bulk must be connected (i.e. it cannot drop into two pieces) and composed of whole unit cubes.

    Input

    There is a single positive integer T on the first line of input. It stands for the number of bulks to follow. Each bulk description begins with a line containing single positive integer F, 6 ≤ F ≤ 250, stating the number of faces. Then there are F lines, each containing one face description. All faces of the bulk are always listed, in any order. Any face may be divided into several distinct parts and described like if it was more faces. Faces do not overlap. Every face has one inner side and one outer side. No side can be "partially inner and partially outer".

    Each face is described on a single line. The line begins with an integer number P stating the number of points that determine the face, 4 ≤ P ≤ 200. Then there are 3 × P numbers, coordinates of the points. Each point is described by three coordinates X, Y, Z (0 ≤ X, Y, Z ≤ 1000) separated by spaces. The points are separated from each other and from the number P by two space characters. These additional spaces were added to make the input more human readable. The face can be constructed by connecting the points in the specified order, plus connecting the last point with the first one.

    The face is always composed of "unit squares", that means every edge runs either in X, Y or Z-axis direction. If we take any two neighbouring points X1, Y1, Z1 and X2, Y2, Z2, then the points will always differ in exactly one of the three coordinates. I.e. it is either X1X2Y2, or Z1Z2, other two coordinates are the same. Every face lies in an orthogonal plane, i.e. exactly one coordinate is always the same for all points of the face. The face outline will never touch nor cross itself.

    Output

    Your program must print a single line for every test case. The line must contain the sentence The bulk is composed of V units., where V is the volume of the bulk.

    Sample Input

    2
    12
    410 10 1010 10 2010 20 2010 20 10
    420 10 1020 10 2020 20 2020 20 10
    410 10 1010 10 2020 10 2020 10 10
    410 20 1010 20 2020 20 2020 20 10
    410 10 1010 20 1020 20 1020 10 10
    510 10 2010 20 2020 20 2020 15 2020 10 20
    414 14 1414 14 1614 16 1614 16 14
    416 14 1416 14 1616 16 1616 16 14
    414 14 1414 14 1616 14 1616 14 14
    414 16 1414 16 1616 16 1616 16 14
    414 14 1414 16 1416 16 1416 14 14
    414 14 1614 16 1616 16 1616 14 16
    12
    420 20 3020 30 3030 30 3030 20 30
    410 10 1010 40 1040 40 1040 10 10
    610 10 2020 10 2020 30 2030 30 2030 40 2010 40 20
    620 10 2020 20 2030 20 2030 40 2040 40 2040 10 20
    410 10 1040 10 1040 10 2010 10 20
    410 40 1040 40 1040 40 2010 40 20
    420 20 2030 20 2030 20 3020 20 30
    420 30 2030 30 2030 30 3020 30 30
    410 10 1010 40 1010 40 2010 10 20
    440 10 1040 40 1040 40 2040 10 20
    420 20 2020 30 2020 30 3020 20 30
    430 20 2030 30 2030 30 3030 20 30

    Sample Output

    The bulk is composed of 992 units.
    The bulk is composed of 10000 units.

    Source

    样例输入

    2
    12
    410 10 1010 10 2010 20 2010 20 10
    420 10 1020 10 2020 20 2020 20 10
    410 10 1010 10 2020 10 2020 10 10
    410 20 1010 20 2020 20 2020 20 10
    410 10 1010 20 1020 20 1020 10 10
    510 10 2010 20 2020 20 2020 15 2020 10 20
    414 14 1414 14 1614 16 1614 16 14
    416 14 1416 14 1616 16 1616 16 14
    414 14 1414 14 1616 14 1616 14 14
    414 16 1414 16 1616 16 1616 16 14
    414 14 1414 16 1416 16 1416 14 14
    414 14 1614 16 1616 16 1616 14 16
    12
    420 20 3020 30 3030 30 3030 20 30
    410 10 1010 40 1040 40 1040 10 10
    610 10 2020 10 2020 30 2030 30 2030 40 2010 40 20
    620 10 2020 20 2030 20 2030 40 2040 40 2040 10 20
    410 10 1040 10 1040 10 2010 10 20
    410 40 1040 40 1040 40 2010 40 20
    420 20 2030 20 2030 20 3020 20 30
    420 30 2030 30 2030 30 3020 30 30
    410 10 1010 40 1010 40 2010 10 20
    440 10 1040 40 1040 40 2040 10 20
    420 20 2020 30 2020 30 3020 20 30
    430 20 2030 30 2030 30 3030 20 30

    样例输出

    The bulk is composed of 992 units.
    The bulk is composed of 10000 units.

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部