#C1152. Largest Rectangle of 1's in a Binary Matrix
Largest Rectangle of 1's in a Binary Matrix
Largest Rectangle of 1's in a Binary Matrix
You are given one or more binary matrices (composed of 0's and 1's). For each matrix, your task is to compute the area of the largest rectangle that consists entirely of 1's. A rectangle is defined by its width and height and its area is given by
Each matrix is provided as a test case and the input ends with a line containing two zeros. Read the input from stdin and output the area for each matrix on a new line to stdout.
inputFormat
The input consists of several test cases. Each test case begins with a line containing two integers (n) and (m), where (n) is the number of rows and (m) is the number of columns of the matrix. This is followed by (n) lines, each containing (m) space-separated integers (either 0 or 1). The input terminates with a line containing '0 0', which should not be processed.
outputFormat
For each test case, output the area of the largest rectangle consisting only of 1's on a separate line to stdout.## sample
4 4
1 0 1 1
1 1 1 1
0 1 1 1
1 1 1 0
0 0
6
</p>