#571. 「Nowcoder多校 2019 Day2」Second Large Rectangle

「Nowcoder多校 2019 Day2」Second Large Rectangle

当前没有测试数据。

题目描述

Given a N×MN \times Mbinary matrix. Please output the size of second large rectangle containing all "1"\texttt{"1"}.

Containing all "1"\texttt{"1"} means that the entries of the rectangle are all "1"\texttt{"1"}.

A rectangle can be defined as four integers x1,y1,x2,y2x_1, y_1, x_2, y_2​ where 1x1x2N 1 \leq x_1 \leq x_2 \leq Nand 1y1y2M1 \leq y_1 \leq y_2 \leq M. Then, the rectangle is composed of all the cell (x, y) where x1xx2x_1 \leq x \leq x_2and y1yy2y_1 \leq y \leq y2. If all of the cell in the rectangle is "1"\texttt{"1"}, this is a valid rectangle.

Please find out the size of the second largest rectangle, two rectangles are different if exists a cell belonged to one of them but not belonged to the other.

输入格式

The first line of input contains two space-separated integers N and M. Following N lines each contains M characters cijc_{ij}.

输出格式

Output one line containing an integer representing the answer. If there are less than 2 rectangles containning all "1"\texttt{"1"}"1", output "0"\texttt{"0"}.

样例

样例输入 1

1 2
01

样例输出 1

0

样例输入 2

1 3
101

样例输出 2

1

数据范围与提示

1≤N,M≤1000

N×M2N \times M \geq 2

cij"01"c_{ij} \in \texttt{"01"}