#T189. 最大子矩阵
最大子矩阵
Description
The size of a matrix is defined as the sum of all its elements. Given a matrix, your task is to find the largest non-empty (with size at least 1 × 1) submatrix.
For example, consider the following 4 × 4 matrix:
0 -2 -7 0
9 2 -6 2
-4 1 -4 1
-1 8 0 -2
The largest submatrix is
9 2
-4 1
-1 8
The size of this submatrix is 15.
Input Format
The input is an N×N matrix. The first line of the input provides N (0 < N ≤ 100).
In the subsequent lines, the N² integers of the matrix are given sequentially (first the N integers of the first row from left to right, then the N integers of the second row from left to right, and so on).
The integers are separated by whitespace characters (spaces or blank lines).
It is known that the integers in the matrix are all within the range [−127, 127].
Output Format
Output the size of the largest submatrix.
0 -2 -7 0
9 2 -6 2
-4 1 -4 1
-1 8 0 -2
9 2
-4 1
-1 8