import java.io.PrintWriter; import java.util.Scanner; public class Main { static Scanner scan = new Scanner(System.in); static PrintWriter out = new PrintWriter(System.out); static int H, W; static char[][] map; static int [][] ansMap; static int[] dx = {-1, 0, 1, -1, 1, -1, 0, 1}; static int[] dy = {-1, -1, -1, 0, 0, 1, 1, 1}; public static void main(String[] args) { String line = scan.nextLine(); String values[] = line.split(" "); H = Integer.parseInt(values[0]); W = Integer.parseInt(values[1]);; map = new char[H][W]; ansMap = new int[H][W]; for(int i=0; i= 0 && nextX < W && nextY >= 0 && nextY < H && map[nextY][nextX] == '#') { ansMap[nextY][nextX] = 1; } } } } } if(!dotFind) { int minLen = Math.min(W, H); System.out.println(minLen==1? 1 : minLen/2); return; } for(int count=1; count<=1500; count++) { //out(); boolean find = false; for(int i=0; i= 0 && nextX < W && nextY >= 0 && nextY < H && ansMap[nextY][nextX] == -1) { ansMap[nextY][nextX] = (count+1); find = true; } } } } } if(find == false) { System.out.println(count); break; } } } static void out() { for(int i=0; i