Checking for an undirected graph
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
For a given square matrix n x n of zeros and ones determine whether it can be the adjacency matrix of a simple undirected graph. The simple graph does not contain loops and multiple edges.
Input
The first line contains the value of n (1 ≤ n ≤ 100). Each of the next n lines contains n numbers, describing the adjacency matrix.
Output
Print YES, if the graph is simple undirected and NO otherwise.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 14K
Acceptance rate 40%