User's AC Ratio

96.9% (31/32)

Submission's AC Ratio

32.4% (35/108)

Description

Given a square matrix.

$
\left[
\begin{matrix}
a_{11} & a_{12} & \cdots & a_{1n}\\
a_{21} & a_{22} & \cdots & a_{2n}\\
\vdots & \vdots & \ddots & \vdots \\
a_{n1} & a_{n2} & \cdots & a_{nn}
\end{matrix}
\right]
$

Please check whether it is a symmetric matrix.

A matrix is a symmetric matrix if and only if the main diagonal of the matrix is its axis of symmetry.
The following matrix is a symmetric matrix.

$
\left[
\begin{matrix}
5 & 20 & 8 & 10\\
20 & 8 & 12 & 4\\
8 & 12 & 7 & 11 \\
10 & 4 & 11 & 2
\end{matrix}
\right]
$

Input Format

First line contains an positive integer $n$, indicates the matrix is $n\times n$.
Following $n$ lines, each line contains $n$ integers. Representing the matrix.

  • $n\leq1000$
  • $0\leq Matrix\ elements \leq 10^ 4$

Output Format

If it is a symmetric matrix, please print Yes, else print No.

Sample Input 1

4
5 20 8 10
20 8 12 4
8 12 7 11
10 4 11 2

Sample Output 1

Yes

Hints

Note: declare too large array in main function may cause Segmentation Fault.

Problem Source

Subtasks

No. Testdata Range Constraints Score
1 0~4 $n=2$ 5
2 0~9 $Matrix\ elements\in \{0,1\}$ 10
3 0~14 No specified restriction 20

Testdata and Limits

No. Time Limit (ms) Memory Limit (KiB) Output Limit (KiB) Subtasks
0 1500 65536 65536 1 2 3
1 1500 65536 65536 1 2 3
2 1500 65536 65536 1 2 3
3 1500 65536 65536 1 2 3
4 1500 65536 65536 1 2 3
5 1500 65536 65536 2 3
6 1500 65536 65536 2 3
7 1500 65536 65536 2 3
8 1500 65536 65536 2 3
9 1500 65536 65536 2 3
10 1500 65536 65536 3
11 1500 65536 65536 3
12 1500 65536 65536 3
13 1500 65536 65536 3
14 1500 65536 65536 3