#P3164. [CQOI2014] 和谐矩阵
[CQOI2014] 和谐矩阵
Description
We call a matrix composed of and harmonious if and only if every element has an even number of adjacent 's. The neighbors of an element include the element itself and its four neighbors above, below, left, and right (if they exist). Given the number of rows and columns of the matrix, compute and output a harmonious matrix. Note: the all-zero matrix is not allowed.
Input Format
The input consists of one line containing two space-separated integers and , denoting the number of rows and columns of the matrix.
Output Format
Output lines, each containing space-separated integers ( or ), forming the required matrix. The testdata guarantees that a solution exists.
4 4
0 1 0 0
1 1 1 0
0 0 0 1
1 1 0 1
Hint
Constraints
.
Thanks to @miaomiao for providing the SPJ.
Translated by ChatGPT 5
京公网安备 11011102002149号