Files
python/TangDou/LanQiaoBei/LanQiaoBei13ShengSai_ZJ_II/6_0.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

52 lines
1.0 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
/*
测试用例I:
5 6
1 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0
0 1 0 0 0 1
1 0 1 0 0 0
答案
4
测试用例II:
5 6
1 0 1 0 0 0
0 1 0 1 1 0
1 0 0 0 1 0
0 1 0 0 0 1
1 0 1 0 0 0
答案
3
*/
using namespace std;
const int INF = 0x3f3f3f3f;
const int N = 110;
int a[N][N];
int res;
int main() {
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= m; j++)
cin >> a[i][j];
// 1e8 =100000000
// 1500000000
for (int i = 1; i <= n; i++) // 1000
for (int j = 1; j <= m; j++) { // 1000
for (int k = 0;; k++) { // 1000 *SQRT(2)=1500
if (i + k > n || j + k > m) break; //越界
if (a[i + k][j + k] == 0) break;
//从[i,j]出发,边长长度为k+1的矩形,内部数字为1的有多少个
res = max(res, k + 1);
}
}
cout << res << endl;
return 0;
}