#ABC264C. [ABC264C] Matrix Reducing
[ABC264C] Matrix Reducing
Score : points
Problem Statement
You are given a matrix with rows and columns, and a matrix with rows and columns.
- For all integer pairs such that and , the element at the -th row and -th column of matrix is .
- For all integer pairs such that and , the element at the -th row and -th column of matrix is .
You may perform the following operations on the matrix any number of (possibly ) times in any order:
- Choose an arbitrary row of and remove it.
- Choose an arbitrary column of and remove it.
Determine if it is possible to make the matrix equal the matrix .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print Yes
if it is possible to make the matrix equal the matrix ;
print No
otherwise.
Note that the judge is case-sensitive.
Removing the -nd column from the initial results in:
Then, removing the -rd row from results in:
Then, removing the -st row from results in:
Then, removing the -th column from results in:
Now the matrix equals the matrix .
Thus, we can make the matrix equal the matrix by repeating the operations, so Yes
should be printed.
Regardless of how we perform the operations, we cannot make the matrix equal the matrix ,
so No
should be printed.