Is the matrix symmetric?
A matrix is called symmetric if the opposite numbers around the main diagonal are equal.
Given an
matrix, our task is to find out if the matrix is symmetric.The first line of the input contains a single integer
n
. The next n
lines contain n
integers which represent the matrix.The output of the program should contain a single line -
yes
if the matrix is symmetric and no
otherwise. Input | Output |
3
0 1 2
1 8 3
2 3 4 | yes |
3
0 0 0
0 0 0
1 0 1 | no |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB