#C13943. Diagonal Zero Checker
Diagonal Zero Checker
Diagonal Zero Checker
In this problem, you are given a matrix of integers and you need to determine whether there exists at least one zero on either the primary diagonal or the secondary diagonal.
The primary diagonal of a matrix (A) is defined as the set of elements (A_{ii}) for (i = 0, 1, \ldots, \min(n, m)-1), where (n) and (m) are the number of rows and columns respectively.
The secondary diagonal is defined as (A_{i,(m-i-1)}) for (i = 0, 1, \ldots, \min(n, m)-1).
Your task is to check if there is any zero in either of these diagonals. If there is, print True
; otherwise, print False
.
inputFormat
The input is read from standard input. The first line contains two space-separated integers (n) and (m) representing the number of rows and columns of the matrix. This is followed by (n) lines, each containing (m) space-separated integers representing the matrix elements.
outputFormat
The output is a single line printed to standard output. Print True
if at least one zero is found on either the primary or secondary diagonal, and False
otherwise.## sample
3 3
1 2 3
4 5 6
7 8 9
False