luogu#P1387. 最大正方形

    ID: 382 远端评测题 1000ms 125MiB 尝试: 3 已通过: 2 难度: 3 上传者: 标签>动态规划 DP福建省历届夏令营枚举前缀和

最大正方形

Problem Description

In an n×mn\times m matrix that contains only 00 and 11, find a largest square that does not contain any 00, and output its side length. It is guaranteed that there is at least one 11 in the matrix.

Input Format

The first line of input contains two integers n,m(1n,m100)n,m(1\leq n,m\leq 100). Then follow nn lines, each containing mm numbers separated by spaces, 00 or 11.

Output Format

A single integer, the side length of the largest square.

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

2

Hint

Translated by ChatGPT 5