P1911 Battle Deployment in Country L

Background

Country L is about to go to war with Country I! The commander of Country L wants each of his barracks to form the national emblem — an "L" shape (any orientation). Of course, his command barracks is an exception (that is called personality). He could not figure out how to arrange them, so the task has fallen to you.

Description

You are given a $2^n \times 2^n$ grid and $\dfrac{4^n-1}{3}$ "L"-shaped trominoes of size $2 \times 2$, numbered from $1$ to $\dfrac{4^n-1}{3}$ (shape shown below): ```plain *. ** ``` Construct a placement so that every cell is covered by some tromino except the cell at row $x$ (from top to bottom) and column $y$ (from left to right). Trominoes may be rotated.

Input Format

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

Output Format

Output $2^n$ lines, each with $2^n$ integers. The number at the $i$-th row and $j$-th column indicates the index of the tromino covering that cell. Specifically, for the cell at row $x$ and column $y$, output $0$. There may be multiple valid answers; output any one of them.

Explanation/Hint

Constraints: $1 \le n \le 10$, $1 \le x, y \le 2^n$. Translated by ChatGPT 5