CF1917E Construct Matrix
Description
You are given an even integer $ n $ and an integer $ k $ . Your task is to construct a matrix of size $ n \times n $ consisting of numbers $ 0 $ and $ 1 $ in such a way that the following conditions are true, or report that it is impossible:
- the sum of all the numbers in the matrix is exactly $ k $ ;
- the bitwise $ \texttt{XOR} $ of all the numbers in the row $ i $ is the same for each $ i $ ;
- the bitwise $ \texttt{XOR} $ of all the numbers in the column $ j $ is the same for each $ j $ .
Input Format
N/A
Output Format
N/A
Explanation/Hint
In the first example, all conditions are satisfied:
- the sum of all the numbers in the matrix is exactly $ 0 $ ;
- the bitwise $ \texttt{XOR} $ of all the numbers in the row $ i $ is $ 0 $ for each $ i $ ;
- the bitwise $ \texttt{XOR} $ of all the numbers in the column $ j $ is $ 0 $ for each $ j $ .
In the third example, it can be shown that it's impossible to find a matrix satisfying all the problem's conditions.