#K2216. Identity Matrix Checker

    ID: 24688 Type: Default 1000ms 256MiB

Identity Matrix Checker

Identity Matrix Checker

Given an n × n matrix, determine if it is an identity matrix. A matrix \(I_n\) is called an identity matrix if:

  • All the elements on its main diagonal are equal to 1, and
  • All other elements are 0.

This matrix satisfies the property \(I_n \cdot A = A\) for any \(n \times n\) matrix \(A\).

inputFormat

The first line of input contains an integer (n) ((1 \le n \le 100)), the size of the matrix. Each of the following (n) lines contains (n) space-separated integers representing one row of the matrix.

outputFormat

Print "True" if the given matrix is an identity matrix. Otherwise, print "False".## sample

3
1 0 0
0 1 0
0 0 1
True