Logo
(追記) (追記ここまで)

19053번 - Tris 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB147770.000%

문제

You are given some domino-like pieces. The following types of pieces are possible:

Note that there are only four types, and you may rotate and reflect any piece for further use. You want to place all the pieces in a matrix of size at most 800ドル \times 800$ so that you get a single non-self-touching cycle. Formally, this means:

  • All pieces must fully fit in the matrix and be aligned with the grid.
  • No two pieces may overlap.
  • If a certain matrix cell is occupied by a piece, then exactly two of its four neighbours must also be occupied.
  • All occupied cells are connected. In other words, you can travel from any occupied cell to any other occupied cell by only moving to adjacent occupied cells.
  • The "interior" of the cycle must be a single 4-connected area.

입력

The input consists of a single line containing four integers: the number of pieces of each type (in the order they are shown in the image). It is guaranteed that each number is at least 2 and at most 100, and that at least one valid answer exists.

출력

The first line of output must contain two integers $N$ and $M$ ($N, M \le 800$) denoting the number of rows and columns in your matrix. The next lines must describe the matrix in the following format:

  • The matrix must contain integers between 0 and the total number of pieces, inclusive.
  • Cells occupied by the same piece must have the same value.
  • Cells occupied by different pieces must have different values.
  • Cells that are not occupied by any piece must have the value 0.

If there are several valid answers, print any one of them.

제한

예제 입력 1

3 4 3 4

예제 출력 1

11 6
0 1 2 4 4 4
1 1 0 0 0 3
8 0 0 0 3 3
8 0 0 0 9 0
8 0 0 0 9 9
10 0 0 0 0 13
10 0 0 0 0 11
12 0 0 0 0 11
12 0 0 0 0 14
6 0 0 0 0 7
6 5 5 5 7 7

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2017 > Day 2: UniBuc Contest K번

Contest > Open Cup > 2017/2018 Season > Stage 1: Grand Prix of Romania K번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /