You are given two matrices $$$A$$$ and $$$B$$$ of size $$$n \times m$$$, filled with integers between $$$0$$$ and $$$10^9$$$. You can perform the following operations on matrix $$$A$$$ in any order and any number of times:
The value of $$$x$$$ may be chosen differently for different operations.
Determine whether it is possible to transform matrix $$$A$$$ into matrix $$$B$$$ using the given operations any number of times (including zero).
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. Then, $$$t$$$ test cases follow.
Each test case is given as follows:
For each test case, output Yes if it is possible to transform the matrix $$$A$$$ into the matrix $$$B$$$; otherwise, output No. Each letter can be output in any case, upper or lower.
41 112132 210 1042 4221 2121 212 274 1042 10621 8585 212 41 2 3 45 6 7 83 2 3 41 0 1 0
Yes Yes No Yes
Let's consider the second set of input data and show a sequence of operations that transforms matrix $$$A$$$ into matrix $$$B$$$:
Initially, the matrix looks like this:
$$$\begin{bmatrix} 10&10\\ 42&42\\ \end{bmatrix}$$$
Apply an operation of the first type with parameters $$$i = 1$$$ and $$$x = 0$$$. As a result, we get the matrix:
$$$\begin{bmatrix} 0&0\\ 42&42\\ \end{bmatrix}$$$
Apply an operation of the first type with parameters $$$i = 2$$$ and $$$x = 0$$$. As a result, we get the matrix:
$$$\begin{bmatrix} 0&0\\ 0&0\\ \end{bmatrix}$$$
Apply an operation of the second type with parameters $$$j = 1$$$ and $$$x = 21$$$. As a result, we get the matrix:
$$$\begin{bmatrix} 21&0\\ 21&0\\ \end{bmatrix}$$$
Apply an operation of the second type with parameters $$$j = 2$$$ and $$$x = 21$$$. As a result, we get the matrix:
$$$\begin{bmatrix} 21&21\\ 21&21\\ \end{bmatrix}$$$
Thus, we have transformed matrix $$$A$$$ into matrix $$$B$$$.
Name |
---|