T581087 「2025 扬大ACM选拔赛」A - Symphony of Lights

题目描述

‘These spotlights are all messed up!’ Milkdragon was spinning around impatiently in the centre of the stage. Seven, however, stared at the grid diagram of the console with her eyes glowing, ‘This is a sound and light array for a concert! Each point of light has to be arranged like a musical note’ In an sound and light array of $n$ rows and $m$ columns, the following rule is to be satisfied. 1. the $i$-th column must be lit with exactly $a_i$ spotlights 2. No neighbouring lights, as neighbouring lights can create sonic booms (up, down, left and right are considered neighbouring) Please help MilkDragon determine if a legal solution exists. If it exists, output any of the legal solutions.

输入格式

The first line of the input contains $n, m$ two positive integers $n \le 300, m \le 300$ guaranteed. The second line of the input contains $m$ non-negative integers $a_1, a_2, \ldots , a_m$, guaranteed $0 \le a_i \le n$.

输出格式

- If it does not work, output `No`. - If successful, play `Yes` followed by $n$ rows of light and shadow quintuplets (`1` is light, `0` is shadow)