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.
4 4
0 1 1 1
1 1 1 0
0 1 1 0
1 1 0 1