{"problem":{"name":"Security Camera 3","description":{"content":"There is a grid with $H$ rows from top to bottom and $W$ columns from left to right. Let $(i, j)$ denote the square at the $i$\\-th row from the top and $j$\\-th column from the left.   Square $(i, j)$ ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc274_g"},"statements":[{"statement_type":"Markdown","content":"There is a grid with $H$ rows from top to bottom and $W$ columns from left to right. Let $(i, j)$ denote the square at the $i$\\-th row from the top and $j$\\-th column from the left.  \nSquare $(i, j)$ is occupied by an obstacle if $S_{i,j}=$ `#`, and is empty if $S_{i,j}=$ `.`.\nTakahashi will install some surveillance cameras in the grid.\nA surveillance camera can be placed at a square without an obstacle, in one of the four directions: up, down, left, or right.  \nMultiple surveillance cameras may be placed at the same square.\nEach surveillance camera monitors the square it is placed at, and the squares in the direction it is placed in, as far as there is no obstacle in between.\nAt least how many surveillance cameras are needed to monitor all squares without an obstacle?\n\n## Constraints\n\n*   $1 \\leq H,W \\leq 300$\n*   $S_{i,j}$ is `.` or `#`.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$H$ $W$\n$S_{1,1}\\ldots S_{1,W}$\n$\\vdots$\n$S_{H,1}\\ldots S_{H,W}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc274_g","tags":[],"sample_group":[["3 3\n...\n.#.\n...","4\n\nFor example, if we install two surveillance cameras at square $(1, 1)$ facing right and down, and another two at square $(3, 3)$ facing up and left, all squares without an obstacle will be monitored."],["3 5\n...##\n.#...\n...#.","5\n\nFor example, if we install two surveillance cameras at square $(1, 1)$ facing right and down, another at square $(3, 3)$ facing left, and another two at square $(2, 5)$ facing left and down, all squares without an obstacle will be monitored.\nNote that the camera at square $(2, 5)$ facing left cannot monitor square $(2, 1)$, since there is an obstacle in between at square $(2, 2)$."],["14 107\n...........................................................................................................\n...........................................................................................................\n..#########..###....###########..###.......###...###########..####.......###...###########...###########...\n..########..###....###########....###.....###...###########...#####......###..###########...###########....\n..#######..###.....###.............###...###....###...........######.....###..###...........###............\n..######..###......###..............###.###.....###...........###.###....###..###...........###............\n..#####..###.......############......#####......############..###..###...###..###...........############...\n..####....###......############.......###.......############..###...###..###..###...........############...\n..###......###.....###................###.......###...........###....###.###..###...........###............\n..##........###....###................###.......###...........###.....######..###...........###............\n..#..........###...############.......###.......############..###......#####..############..############...\n..............###...###########.......###........###########..###.......####...###########...###########...\n...........................................................................................................\n...........................................................................................................","91"]],"created_at":"2026-03-03 11:01:14"}}