#K70042. Maximum Rectangle of Crops

    ID: 33220 Type: Default 1000ms 256MiB

Maximum Rectangle of Crops

Maximum Rectangle of Crops

You are given a binary grid of size \(m\times n\) where each cell represents a patch of land. A value 1 indicates that the cell contains a crop and a value 0 indicates empty land. Your task is to determine the area of the largest rectangle (contiguous submatrix) that contains only crops.

The area of a rectangle is calculated as \(\text{Area} = \text{height} \times \text{width}\).

Input Format: The grid dimensions and the grid itself are provided via standard input.

Output Format: Output the area of the largest rectangle consisting entirely of 1s to standard output.

Example:

Input:
4 4
1 0 1 0
1 0 1 1
1 1 1 1
0 1 0 0

Output: 4

</p>

inputFormat

The first line contains two integers \(m\) and \(n\) which represent the number of rows and columns of the grid, respectively. Following this, there are \(m\) lines, each containing \(n\) space-separated integers (0 or 1), representing the grid.

outputFormat

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

## sample
4 4
1 0 1 0
1 0 1 1
1 1 1 1
0 1 0 0
4