~/algor $ cat problems/stack-eng-katta-tortburchak
Largest rectangle of ones
Hard
2000 ms
128 MB
95%
Each cell of a table with $n$ rows and $m$ columns contains $0$ or $1$. Find the area (the number of cells) of the largest rectangle whose sides go along the table lines and which consists only of cells with $1$. If the table has no $1$, print $0$.
Input
The first line contains two positive integers: $n$ and $m$.
Each of the next $n$ lines contains a string of $m$ characters (0 or 1).
Output
One integer — the largest area.
Note
$1 \le n, m \le 300$
Examples
Input #1
4 5 10100 10111 11111 10010
Output #1
6
Input #2
1 1 0
Output #2
0