#t368. 最大子矩阵
最大子矩阵
Maximum Submatrix
Problem Background
Special for beginners, ^_^
Problem 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 (of size at least ) submatrix. For example, in the following matrix
0 -2 -7 0
9 2 -6 2
-4 1 -4 1
-1 8 0 -2
the maximum submatrix is
9 2
-4 1
-1 8
whose size is .
Input Format
The input is an matrix.
The first line gives . In the following lines, in order (first the integers of the first row from left to right, then the integers of the second row from left to right, and so on), the integers of the matrix are given, separated by whitespace (spaces or blank lines). It is known that all integers in the matrix are in the range .
Output Format
Output the size of the maximum submatrix.
Sample Input
4
0 -2 -7 0
9 2 -6 2
-4 1 -4 1
-1 8 0 -2
Sample Output
15
Constraints
1s, 1024KiB for each test case.