~/algor $ cat problems/matritsa-pastki-uchburchakmi
Lower triangular matrix?
Easy
1000 ms
64 MB
32%
A square matrix of size $n \times n$ is given. A matrix is called lower triangular if all elements above the main diagonal ($a_{i,j}$ with $j \gt i$) are zero. If it is, print YES, otherwise print NO.
Input
The first line contains a positive integer $n$.
Each of the next $n$ lines contains $n$ integers — the matrix.
Output
YES or NO.
Note
$1 \le n \le 100$
$-1000 \le a_{i,j} \le 1000$
Examples
Input #1
3 4 0 0 2 -1 0 5 3 7
Output #1
YES
Input #2
2 1 2 0 3
Output #2
NO