CF1016D Vasya And The Matrix
Description
Now Vasya is taking an exam in mathematics. In order to get a good mark, Vasya needs to guess the matrix that the teacher has constructed!
Vasya knows that the matrix consists of $ n $ rows and $ m $ columns. For each row, he knows the xor (bitwise excluding or) of the elements in this row. The sequence $ a_{1},a_{2},...,a_{n} $ denotes the xor of elements in rows with indices $ 1 $ , $ 2 $ , ..., $ n $ , respectively. Similarly, for each column, he knows the xor of the elements in this column. The sequence $ b_{1},b_{2},...,b_{m} $ denotes the xor of elements in columns with indices $ 1 $ , $ 2 $ , ..., $ m $ , respectively.
Help Vasya! Find a matrix satisfying the given constraints or tell him that there is no suitable matrix.
Input Format
The first line contains two numbers $ n $ and $ m (2
Output Format
If there is no matrix satisfying the given constraints in the first line, output "NO".
Otherwise, on the first line output "YES", and then $ n $ rows of $ m $ numbers in each $ c_{i1},c_{i2},...\ ,c_{im} (0