Problem5918--最大正方形

5918: 最大正方形

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

在一个 $n*m$ 的只包含 $0$ 和 $1$ 的矩阵里找出一个不包含 $0$ 的最大正方形,输出边长。

Input

输入文件第一行为两个整数 $n,\ m\ (1 \leq n,\ m \leq 100)$,接下来 $n$ 行,每行 $m$ 个数字,用空格隔开,$0$ 或 $1$。

Output

一个整数,最大正方形的边长。

Sample 1 Input

4 4
0 1 1 1
1 1 1 0
0 1 1 0
1 1 0 1

Sample 1 Output

2

Sample 2 Input

1 1
1

Sample 2 Output

1

Sample 3 Input

5 5
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0

Sample 3 Output

0

HINT

题目来源:洛谷 P1387

Source/Category