#P1911. L 国的战斗之排兵布阵

L 国的战斗之排兵布阵

Description

You are given a 2n×2n2^n \times 2^n grid and 4n13\dfrac{4^n-1}{3} "L"-shaped trominoes of size 2×22 \times 2, numbered from 11 to 4n13\dfrac{4^n-1}{3} (shape shown below):

*.
**

Construct a placement so that every cell is covered by some tromino except the cell at row xx (from top to bottom) and column yy (from left to right). Trominoes may be rotated.

Input Format

One line with three integers n,x,yn, x, y.

Output Format

Output 2n2^n lines, each with 2n2^n integers. The number at the ii-th row and jj-th column indicates the index of the tromino covering that cell. Specifically, for the cell at row xx and column yy, output 00.

There may be multiple valid answers; output any one of them.

4 1 3
1 1 0 2 3 3 4 4 5 5 6 6 7 7 8 8
1 9 2 2 3 10 10 4 5 11 11 6 7 12 12 8
13 9 9 14 15 15 10 16 17 11 18 18 19 19 12 20
13 13 14 14 21 15 16 16 17 17 18 22 22 19 20 20
23 23 24 21 21 25 26 26 27 27 28 28 22 29 30 30
23 31 24 24 25 25 32 26 27 33 33 28 29 29 34 30
35 31 31 36 37 32 32 38 39 39 33 40 41 34 34 42
35 35 36 36 37 37 38 38 43 39 40 40 41 41 42 42
44 44 45 45 46 46 47 43 43 48 49 49 50 50 51 51
44 52 52 45 46 53 47 47 48 48 54 49 50 55 55 51
56 52 57 57 58 53 53 59 60 54 54 61 62 62 55 63
56 56 57 64 58 58 59 59 60 60 61 61 65 62 63 63
66 66 67 64 64 68 69 69 70 70 71 65 65 72 73 73
66 74 67 67 68 68 75 69 70 76 71 71 72 72 77 73
78 74 74 79 80 75 75 81 82 76 76 83 84 77 77 85
78 78 79 79 80 80 81 81 82 82 83 83 84 84 85 85

Hint

Constraints: 1n101 \le n \le 10, 1x,y2n1 \le x, y \le 2^n.

Translated by ChatGPT 5