Problem1293--Building

1293: Building

[Creator : ]
Time Limit : 1 sec  Memory Limit : 128 MB

Description

CTJ team were going to build a house which needed a square land. Now they are inspecting a large area of land, but there are pits or large rocks on the ground, which could not be covered by house. So you are giving the terrain. Can you help them find the largest area of the house?

Input

The first line has two integers n, m (1<=n, m<=1000),for the entire land surface. Followed by n lines, each line of m numbers separated by spaces. 0 means that the block of land has pits or rocks, and 1 means that the block of land is intact.

Output

An integer, the length of the largest square.

Sample Input Copy

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

Sample Output Copy

2

Source/Category