请求增强数据
查看原帖
请求增强数据
1315234
vincent_x楼主2024/5/15 13:56
#include<bits/stdc++.h>
using namespace std;
const int N = 1500 + 100;
int n, m, a[N][N], ans = -99, pd;
void dfs(int x, int y, int xx, int yy)
{
	for (int i = x+1; i <= xx; i++) {
		if (a[i][yy] == a[i - 1][yy]) return;
	}
	for (int i = y+1; i <= yy; i++) {
		if (a[xx][i] == a[xx][i - 1]) return;
	}
	++pd;
	dfs(x, y, xx + 1, yy + 1); 
	return;
}
int main()
{
	ios::sync_with_stdio(false);
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
		for (int k = 1; k <= m; k++)
			cin >> a[i][k];
	for (int i = 1; i <= n; i++) 
		for (int k = 1; k <= m; k++) {
			pd = 0;
			dfs(i, k, i, k);
			ans = max(ans, pd);
		}
	cout << ans << endl;
	return 0;
}

hack: 2 2 0 0 0 1 该代码能通过全部测试点,但该hack显然无法通过

2024/5/15 13:56
加载中...