8584: DPL_3_A : Largest Square
[Creator : ]
Description
Given a matrix $(H × W)$ which contains only 1 and 0, find the area of the largest square matrix which only contains 0s.
Input
$H\ W$
$c_{1,1}\ c_{1,2}\ ...\ c_{1,W}$
$c_{2,1}\ c_{2,2}\ ...\ c_{2,W}$
$:$
$c_{H,1}\ c_{H,2}\ ...\ c_{H,W}$
In the first line, two integers $H$ and $W$ separated by a space character are given.
In the following $H$ lines, $c_{i,j}, elements of the $H × W$ matrix, are given.
Output
Print the area (the number of 0s) of the largest square.
Constraints
$1 ≤ H, W ≤ 1,400$
Sample 1 Input
4 5
0 0 1 0 0
1 0 0 0 0
0 0 0 1 0
0 0 0 1 0
Sample 1 Output
4