CF1475F Unusual Matrix

题目描述

给你两个 $n\times n$ 的01矩阵,你可以进行如下两种操作: - 垂直xor:选中一列,将这一列的每个元素分别进行xor - 水平xor:选中一行,将这一行的每个元素分别进行xor 给定 $a,b$ 两个矩阵,问你 $a$ 是否可以在进行有限次操作后变为 $b$ 例如: $$ a=\begin{pmatrix} 1 & 1 & 0 \\ 0 & 0 & 1 \\ 1 & 1 & 0 \end{pmatrix},b=\begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{pmatrix} $$ 先使第一行进行水平xor: $$ a=\begin{pmatrix} 0 & 0 & 1 \\ 0 & 0 & 1 \\ 1 & 1 & 0 \end{pmatrix} $$ 再使第三行进行水平xor: $$ a=\begin{pmatrix} 0 & 0 & 1 \\ 0 & 0 & 1 \\ 0 & 0 & 1 \end{pmatrix} $$ 最后使第三列进行垂直xor即可

输入格式

输出格式

说明/提示

The first test case is explained in the statements. In the second test case, the following sequence of operations is suitable: - horizontal xor, $ i=1 $ ; - horizontal xor, $ i=2 $ ; - horizontal xor, $ i=3 $ ; It can be proved that there is no sequence of operations in the third test case so that the matrix $ a $ becomes equal to the matrix $ b $ .