#P6980. [NEERC2015] Hypercube
[NEERC2015] Hypercube
题目描述
Consider a also known as tesseract. A unit solid tesseract is a 4D figure that is equal to the convex hull of points with Cartesian coordinates -- its vertices. It has edges square faces and cubic (3D) also known as cells. We study hollow tesseracts and define a tesseract as a boundary of a solid tesseract. Thus, a tesseract is a connected union of solid cubes (its cells) that intersect between each other at tesseract's square faces, edges, and vertices.
Let's cut a tesseract along of its faces, so that it still remains connected via faces that were left intact. Unfold the tesseract into a 3D hyperplane by rotating its constituting cubes along the faces that were left intact until all its cells lie in the same 3D hyperplane. The result is called a of a tesseract. This process is a natural generalization of how a 3D cube is cut and unfolded onto a 2D plane to produce a of a cube that consists of squares.
In this problem you are given a tree-like in 3D space also known as octocube. An octocube is a collection of unit cubical cells joined face-to-face. More formally, intersection of each pair of cubical cells constituting an octocube is either empty, a point, a unit line or a unit square The given octocube is tree-like in the following sense. Consider an adjacency graph of the octocube -- a graph with vertices corresponding to its cells. There is an edge in the adjacency graph between pairs of adjacent cells. Two cells of an octocube are called adjacent when their intersection is a square. Cells that intersect at a point or a line are not considered adjacent. An octocube is called tree-like when its adjacency graph is a tree.
Your task is to determine whether the given tree-like octocube constitutes a of a tesseract. That is, whether this octocube being put onto a hyperplane in 4D space can be folded in 4D space along the squares of intersection between its cells into a tesseract.
For example, look at the leftmost picture below. It shows a wire-frame of the tree-like octocube. Rotate cell around a plane GHLK and cell around a plane FGKJ at angle degrees in dimension outside of the original hyperplane. As a result, point joins with and joins with The face is glued to face The result is shown on the right. The dimension is orthographically projected onto the shown in perspective. The points that have moved out of the original hyperplane are marked with hollow dots.
Rotate around EFJI and around EHLI. The result is shown on the following picture on the left. The remaining steps are as follows. Rotate MNOPQRST around MNOP, then rotate both MNOPQRST and IJKLMNOP around IJKL and rotate ABCDEFGH around EFGH. The last step is to glue all faces that meet together to get a tesseract that is shown on the right.
输入格式
The first line of the input file contains there integers -- the width, the depth, and the height of the box that contains the given octocube . The following groups of lines describe rectangular slices of the box from top to bottom. Each slice is described by rows with characters each. The characters on a line are either denoting an empty space, or denoting a unit cube. The input file is guaranteed to describe a tree-like octocube.
输出格式
Write to the output file a single word Yes
if the given octocube can be folded into a tesseract or No
otherwise.
题目大意
给定一个三维图形,保证相邻小方格之间构成树形结构,判断它是否是4维超立方体的一个三维展开。
3 3 4
...
.x.
...
.x.
xxx
.x.
...
.x.
...
...
.x.
...
Yes
8 1 1
xxxxxxxx
No
提示
Time limit: 1 s, Memory limit: 256 MB.