Start: Dec, 04, 2016 12:00:00
杭州师范大学第十届程序设计竞赛—正式
End: Dec, 04, 2016 17:00:00
Time elapsed:
Time remaining:

Problem_ID: H
Result: Accepted
Time: 492ms
Memory: 46540kB
In contest: 1075

#include<bits/stdc++.h>
using namespace std;
const int MAX=3030;
int n,m,ans=0;
bool s[MAX][MAX];
int dp[MAX][MAX];
int c[MAX];

int main(){

	memset(s,0,sizeof(s));
	memset(c,0,sizeof(c));
	memset(dp,0,sizeof(dp));
	cin>>n>>m;
	string tmp1;
	for(int i=1;i<=n;i++)
	{
		cin>>tmp1;
		for(int j=1;j<=m;j++)
		{
			if(tmp1[j-1]=='.')s[i][j]=false;
			else s[i][j]=true;
		}
	}

	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			if(s[i][j]) dp[i][j]=min(min(dp[i][j-1],dp[i-1][j-1]),dp[i-1][j])+1;
			else dp[i][j]=0;
			c[i]=max(c[i],dp[i][j]);
		}
		ans=max(ans,(c[i]+1)/2);
	}
	cout<<ans<<endl;
	return 0;
}