Problems > Symmetric Matrix

Symmetric Matrix

Difficulty: 1000 2000 ms 128 MB

implementation

Is the square matrix symmetric (equal to its own transpose)?

Input: the first line has N and N; the next N lines each have N integers.

Output: YES or NO.

Constraints:

  • 1 ≤ N ≤ 100
  • −104 ≤ values ≤ 104

Sample Tests

Input 1
2 2
1 2
2 1
Output 1
YES
Input 2
2 2
1 2
3 1
Output 2
NO

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.