← 返回 twosigma 的题目列表Find the Largest All-Ones Submatrix in a Binary Matrix
类型:online_judge
Given a binary matrix matrix of size m x n containing only 0/1, compute the area of the largest submatrix consisting of all 1s (the submatrix must be a contiguous rectangle of rows and columns).
Return the maximum area (return 0 if there is no 1).
Constraints (assumptions you may use):
1 <= m, n <= 2000
Example 1:
Input:
4 5
1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
Output:
6
Example 2:
Input:
2 2
0 0
0 0
Output:
0
Example
Input
4 5
1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
Output
6