#pragma GCC optimize ("O3") #pragma GCC target ("avx") #include using namespace std; short h, w, dp[3001]; char g[3002]; int main() { cin >> h >> w; cin.ignore(); short ans = 0; for (int i = 0; i < h; i++) { gets(g + 1); // a dp0[i] // dp1[i - 1] dp1[i] short a = 0; for (int j = 1; j <= w; j++) { short tmp = dp[j]; dp[j] = g[j] == '.' ? 0 : min({ a, dp[j], dp[j - 1] }) + 1; a = tmp; ans = max(ans, dp[j]); } } cout << (ans + 1) / 2 << endl; }