{"problem":{"name":"Darker and Darker","description":{"content":"You are given a grid of squares with $H$ horizontal rows and $W$ vertical columns, where each square is painted white or black. $HW$ characters from $A_{11}$ to $A_{HW}$ represent the colors of the sq","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"agc033_a"},"statements":[{"statement_type":"Markdown","content":"You are given a grid of squares with $H$ horizontal rows and $W$ vertical columns, where each square is painted white or black. $HW$ characters from $A_{11}$ to $A_{HW}$ represent the colors of the squares. $A_{ij}$ is `#` if the square at the $i$\\-th row from the top and the $j$\\-th column from the left is black, and $A_{ij}$ is `.` if that square is white.\nWe will repeatedly perform the following operation until all the squares are black:\n\n*   Every white square that shares a side with a black square, becomes black.\n\nFind the number of operations that will be performed. The initial grid has at least one black square.\n\n## Constraints\n\n*   $1 \\leq H,W \\leq 1000$\n*   $A_{ij}$ is `#` or `.`.\n*   The given grid has at least one black square.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$H$ $W$\n$A_{11}$$A_{12}$$...$$A_{1W}$\n$:$\n$A_{H1}$$A_{H2}$$...$$A_{HW}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"agc033_a","tags":[],"sample_group":[["3 3\n...\n.#.\n...","2\n\nAfter one operation, all but the corners of the grid will be black. After one more operation, all the squares will be black."],["6 6\n..#..#\n......\n#..#..\n......\n.#....\n....#.","3"]],"created_at":"2026-03-03 11:01:14"}}