#K38582. Maximal Vacant Park Rectangle
Maximal Vacant Park Rectangle
Maximal Vacant Park Rectangle
Given a grid of size \(m \times n\) representing a city layout, where '1' indicates a building and '0' indicates a vacant lot, your task is to determine the area of the largest rectangular park that can be developed exclusively on vacant lots. The rectangle must be axis-aligned.
The grid is provided as \(m\) rows, each with \(n\) space-separated characters. Use an efficient algorithm to compute the maximal rectangle that contains only '0's. A common approach is to convert each row into a histogram and then use a stack-based technique to find the largest rectangle in that histogram.
inputFormat
The input is read from standard input (stdin) in the following format:
- The first line contains two integers \(m\) and \(n\) (\(1 \le m, n \le 200\)), representing the number of rows and columns of the grid, respectively.
- The next \(m\) lines each contain \(n\) space-separated characters (each being either '0' or '1'), representing the city grid.
outputFormat
Output to standard output (stdout) a single integer representing the area of the largest rectangle composed entirely of '0's.
## sample4 5
1 0 1 0 0
1 0 1 1 1
1 0 1 1 1
1 0 0 0 1
4