#include inline int max(int a, int b) { return a>b?a:b; } /**/ int main() { int height,width; std::cin>>height>>width; height+=2; width +=2; int*map=new int[height*width]; char ch=0; int index=0; for (int i = 0; i < width; i++) { map[index]=-1; index++; } index--; while (ch!=EOF) { if(index>=height*width-width)break; if (index%width == width - 1) { map[index+1]=-1; map[index] = -1; index+=2; } ch=getchar(); switch (ch) { case '.': map[index]=-1; index++; break; case '#': map[index]= 4000; index++; default: break; } } for (int i = 0; i < width; i++) { map[index] = -1; index++; } for (int x1 = 0; x1 < width; x1++) { for (int y1 = 0; y1 < height; y1++) { if (map[x1 + y1*width] == -1) { for (int x2 = 0; x2 < width; x2++) { for (int y2 = 0; y2 < height; y2++) { if (map[x2 + y2*width]!=0&&map[x2 + y2*width] > max(abs(x1 - x2), abs(y1 - y2))) { map[x2 + y2*width]= max(abs(x1 - x2), abs(y1 - y2)); } } } } } } int max=0; for (int i = 0; i < height*width; i++) { if (max < map[i]) { max=map[i]; } } std::cout<