Futon

AtCoder
IDhhkb2020_b
Time2000ms
Memory256MB
Difficulty
We have a grid with $H$ horizontal rows and $W$ vertical columns of squares, where each square is tidy or untidy. You will now place a mattress on this grid. The mattress can be placed on two horizontally or vertically adjacent tidy squares in the grid. Given are integers $H$, $W$, and $H$ strings $S_i$ of length $W$ each. If the $j$\-th character of $S_i$ is `.`, the square at the $i$\-th row from the top and the $j$\-th column from the left is tidy; if the $j$\-th character of $S_i$ is `#`, the square at the $i$\-th row from the top and the $j$\-th column from the left is untidy. Find the number of ways to choose the position for the mattress. ## Constraints * $2 \leq H \leq 100$ * $2 \leq W \leq 100$ * $S_i$ is a string of length $W$ consisting of `.` and `#`. ## Input Input is given from Standard Input in the following format: $H$ $W$ $S_1$ $:$ $S_H$ [samples]
Samples
Input #1
2 3
..#
#..
Output #1
3

We have the following three choices:

*   the $1$\-st and $2$\-nd squares from the left in the $1$\-st row from the top;
*   the $2$\-nd and $3$\-rd squares from the left in the $2$\-nd row from the top; and
*   the $1$\-st and $2$\-nd squares from the top in the $2$\-nd column the left.
Input #2
2 2
.#
#.
Output #2
0
API Response (JSON)
{
  "problem": {
    "name": "Futon",
    "description": {
      "content": "We have a grid with $H$ horizontal rows and $W$ vertical columns of squares, where each square is tidy or untidy. You will now place a mattress on this grid. The mattress can be placed on two horizont",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "hhkb2020_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "We have a grid with $H$ horizontal rows and $W$ vertical columns of squares, where each square is tidy or untidy.\nYou will now place a mattress on this grid.\nThe mattress can be placed on two horizont...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments