#C7265. Minimum Operations to Zero Matrix
Minimum Operations to Zero Matrix
Minimum Operations to Zero Matrix
You are given an N × N matrix of non-negative integers. In one operation, you can subtract 1 from every positive element in the matrix simultaneously. Your task is to determine the minimum number of operations required to reduce the entire matrix to zeros.
Hint: Since you can decrease all positive elements at the same time, the answer is equal to the maximum element in the matrix.
inputFormat
The input begins with an integer T representing the number of test cases. For each test case, the first line contains an integer N denoting the size of the matrix. This is followed by N lines, each containing N space-separated integers representing the rows of the matrix.
outputFormat
For each test case, output a single integer on a separate line representing the minimum number of operations required to make every element of the matrix equal to zero.
## sample1
2
3 2
1 4
4
</p>