#C3458. Largest Equal Submatrix

    ID: 46887 Type: Default 1000ms 256MiB

Largest Equal Submatrix

Largest Equal Submatrix

You are given a matrix with r rows and c columns. Your task is to find the area of the largest rectangular submatrix in which all the elements are equal.

Formally, if the submatrix spans from row i to j and from column k to l, then all elements in this submatrix must have the same value, and its area is calculated as \( (j - i + 1) \times (l - k + 1) \).

You need to output a single integer representing the maximum area of such a submatrix.

inputFormat

The first line contains two space-separated integers \( r \) and \( c \), denoting the number of rows and columns in the matrix.

The following \( r \) lines each contain \( c \) space-separated integers, representing the rows of the matrix.

outputFormat

Output a single integer which is the area of the largest submatrix where all elements are equal.

## sample
3 4
1 2 2 2
2 2 2 2
2 2 2 1
6