#C1263. Maximum Communication Area

    ID: 42078 Type: Default 1000ms 256MiB

Maximum Communication Area

Maximum Communication Area

You are given a grid of sensors represented as a binary matrix with 1 indicating an active sensor and 0 indicating an inactive sensor. Your task is to compute the area of the largest rectangle (aligned with the grid) that is composed entirely of active sensors.

Hint: You may find it useful to transform each row into a histogram where the height of each bar represents the count of consecutive active sensors up to that row, then apply the largest rectangle in histogram technique.

The input will be provided via standard input and the output is expected to be printed to standard output.

inputFormat

The first line contains two integers m and n — the number of rows and columns respectively.

The following m lines each contain n space-separated integers (either 0 or 1) representing the rows of the grid.

outputFormat

Output a single integer: the area of the largest rectangle that contains only active sensors (1).

## sample
4 5
1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
6