#C10307. Largest Park Area
Largest Park Area
Largest Park Area
You are given a grid that represents the layout of a city. Each cell of the grid is either empty land (denoted by '0') or a building (denoted by '1'). The objective is to design the largest possible rectangular park that can be built exclusively on empty land. The rectangle must be aligned with the grid rows and columns.
Formally, given an n × m grid, you need to determine the area of the largest rectangle that consists entirely of '0's. If no such rectangle exists, output 0.
The solution may involve techniques such as using histograms for each row and applying a stack-based algorithm to compute the largest rectangle in a histogram.
Note: The indices of the rows and columns start from 0.
inputFormat
The input is read from stdin and has the following format:
n m row1 row2 ... rown
where n and m are integers representing the number of rows and columns, respectively. Each of the next n lines contains a string of length m consisting only of the characters '0' and '1'.
outputFormat
Output a single integer to stdout representing the area of the largest rectangular park that can be built (i.e. the largest rectangle consisting entirely of '0's).
## sample4 4
1010
1001
1110
0000
4