아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Ball of Whacks

시간 제한1초메모리 제한1024 MB

요약
30조각 마름모삼십면체의 연결된 세 부분이 주어질 때, 회전시켜 서로 맞춰 완전한 공을 만들 수 있는지 판정한다.
난이도

보통10점 중 6점

유형
기하, 완전 탐색, 시뮬레이션, 조합론
정답자
아직 제출이 없습니다

문제

Danny has a new toy called Ball of Whacks. It's a rhombic triacontahedron (which we all know is a thirty sided polyhedron) made of small pyramid-shaped pieces which look like the following:

Figure C.1: Game piece.

When all 3030 pieces are all put together, they form the object shown in Figure C.2a. Figures C.2b--C.2f show one way to build a rhombic triacontahedron: at the bottom is a petal-shaped section of five pyramids (C.2b --- note that only the base of each pyramid piece is shown); on top of that is a ring of five more pieces (C.2c); on top of that is a larger ring of ten pieces (C.2d), following by a five-piece ring (C.2e) and another petal-shaped section (C.2f). Figure C.3 contains two other views showing how the pieces are connected to one another.

Figure C.2: Construction of a Ball of Whacks.

Figure C.3: Numbering scheme of an assembled Ball of Whacks

Danny has several friends who also own Balls of Whacks, and when they get together…\ldots well, balls get whacked. The result are a number of sections of varying size and shape lying on the floor. When it's time to go home, Danny needs to know which sections fit together to make one complete Ball of Whacks. He would like you to help him.

입력

The input file consists of descriptions of three Ball of Whacks sections, each description on a single line. Each description starts with an integer mm indicating the number of pyramid-shaped pieces in the section, followed by a set of numbers between 11 and 3030 indicating the relative alignment of the pyramid pieces in the section, using the numbered locations in diagrams Figure C.2b-C.2f. Each section description starts with a piece in position 11, though that piece --- along with all other pieces in the section --- may need to be moved in order for all three sections to fit together. The pieces in any section will be connected; i.e., you can get from any one piece in a section to any other by crossing over pieces which share an internal face.

출력

Output either Yes if the three sections can be fit together to get one Ball of Whacks, or No if they cannot be fit together.

예제2

  1. 예제 1

    입력
    25 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
    3 1 2 3
    2 1 2
    
    예상 출력
    Yes
    
  2. 예제 2

    입력
    24 1 4 5 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 24 25 26 27 30
    5 1 2 3 4 5
    1 1
    
    예상 출력
    No