#K80757. Quasi-Symmetric Matrix Verification
Quasi-Symmetric Matrix Verification
Quasi-Symmetric Matrix Verification
Given an n x n matrix A, determine if it is quasi-symmetric. A matrix is defined to be quasi-symmetric if for every pair of indices \( (i,j) \), the following condition holds:
$$ A[i][j] + A[j][i] = A[n-1-i][n-1-j] + A[n-1-j][n-1-i] $$
You are required to read the matrix from the standard input and output "YES" if it satisfies the condition, or "NO" otherwise.
inputFormat
The first line of input contains an integer n, the size of the matrix. Each of the next n lines contains n space-separated integers representing the elements of the matrix.
outputFormat
Output a single line with "YES" if the matrix is quasi-symmetric, otherwise output "NO".## sample
3
1 2 3
4 5 6
7 8 9
NO