#K37687. 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 a binary matrix with n rows and m columns. Each cell in the matrix contains either a '0' or a '1'. Your task is to determine the area of the largest rectangle (formed by contiguous cells) that contains only '1's.
Formally, if the matrix is denoted as \( A \) of size \( n \times m \), find the maximum area \( A_{max} \) such that there exists a submatrix all of whose entries are '1'.
Input Format: The input is provided via standard input (stdin). The first line contains two integers n and m separated by a space. The following n lines each contain a string of length m consisting only of the characters '0' and '1'.
Output Format: Print a single integer representing the area of the largest rectangle containing only '1's. The output should be written to standard output (stdout).
inputFormat
The first line contains two integers n and m: the number of rows and the number of columns in the matrix, respectively.
The next n lines each contain a string of length m consisting solely of the characters '0' and '1'.
outputFormat
Output a single integer on one line which represents the area of the largest rectangle that contains only '1's.
## sample4 4
1010
1011
1110
1000
4
</p>