#C2159. Check if a Matrix is Binary-Symmetric
Check if a Matrix is Binary-Symmetric
Check if a Matrix is Binary-Symmetric
You are given a matrix of integers. Your task is to determine whether the matrix is a binary-symmetric matrix. A binary-symmetric matrix satisfies the following conditions:
- Every element is either 0 or 1.
- The matrix is symmetric, i.e., for every (i, j), we have (a_{ij} = a_{ji}).
If the matrix is not square (including an empty matrix), output the error message: The input is not a square matrix.
Read the matrix from standard input and write your result to standard output.
inputFormat
The first line of input contains two integers r and c separated by a space, representing the number of rows and columns respectively. Each of the next r lines contains c integers separated by spaces, representing the elements of the matrix.
outputFormat
If the matrix is not square or is empty, print exactly:
The input is not a square matrix.
Otherwise, print True
if the matrix is binary-symmetric; otherwise, print False
.## sample
3 3
1 0 1
0 1 0
1 0 1
True