#K41302. Maximal Rectangle in a Mall Grid
Maximal Rectangle in a Mall Grid
Maximal Rectangle in a Mall Grid
You are given a grid representing the layout of a shopping mall. Each cell in the grid is either an empty space denoted by .
or a store denoted by *
. Your task is to determine the area of the largest rectangle that can be formed using only store cells.
In this problem, a rectangle is defined by a contiguous block of cells aligned with the grid. The area is computed as the number of cells within the rectangle. Formally, if a rectangle has height h and width w, its area is given by $$ A = h \times w $$.
Note: The rectangle must be formed entirely by cells marked with *
.
inputFormat
The input is given via standard input (stdin) and has the following format:
r row1 row2 ... rowr
Where r
is an integer representing the number of rows in the grid, and each subsequent line represents one row of the grid. Each row is a string composed of the characters .
and *
.
outputFormat
Output a single integer to standard output (stdout): the area of the largest rectangle that consists entirely of store cells (denoted by *
).
4
.....
.***.
.***.
.....
6