P1319 Compression Technique

Description

Suppose a Chinese character is represented by an $N \times N$ dot-matrix pattern of $\texttt 0$ and $\texttt 1$. We generate a compression code according to the following rule. A sequence of consecutive counts: start from the first symbol of the first row of the dot-matrix pattern, and scan in reading order, left to right and top to bottom. The first number is how many consecutive $\texttt 0$ appear, the second number is how many consecutive $\texttt 1$ appear next, the third number is how many consecutive $\texttt 0$ appear next, the fourth number is how many consecutive $\texttt 1$ appear next, and so on. For example, the following dot-matrix pattern: ``` 0001000 0001000 0001111 0001000 0001000 0001000 1111111 ``` corresponds to the compression code: $\texttt {7 3 1 6 1 6 4 3 1 6 1 6 1 3 7}$ (the first number is $N$, the remaining numbers alternately denote the counts of 0 and 1. It is guaranteed that $N \times N=$ the sum of those alternating counts).

Input Format

The input is one line containing several integers separated by spaces, representing the compression code. Among them, the first integer of the compression code is $N$, indicating that the dot matrix should be of size $N\times N$. The meanings of the remaining integers are as described in the problem statement.

Output Format

Output an $N\times N$ 01 matrix representing the final dot-matrix pattern of the character (do not print spaces between symbols).

Explanation/Hint

Sample Explanation ![](https://cdn.luogu.com.cn/upload/image_hosting/rsx9qytk.png) Constraints It is guaranteed that $3\leq N\leq 200$. Translated by ChatGPT 5