#K86862. Maximum Guest Seating Arrangement
Maximum Guest Seating Arrangement
Maximum Guest Seating Arrangement
You are given a seating arrangement in the form of a grid with N rows. Each cell of the grid is either a reserved seat denoted by R
or an available seat denoted by .
. Your task is to determine the maximum number of guests that can be seated such that no two guests are adjacent in any of the eight directions (horizontally, vertically, or diagonally).
Formally, if a guest is seated at cell \((i,j)\) and another at cell \((k, \ell)\), they must satisfy either
so that they are not neighbors.
Note: The guests can only be placed on available seats (cells containing .
), and reserved seats (R
) must be left empty.
inputFormat
The input is read from stdin and has the following format:
- An integer
N
representing the number of rows in the seating arrangement. N
lines follow, each containing a string. Each string represents a row in the seating grid. The characters in the string will be eitherR
(reserved) or.
(available).
outputFormat
Output a single integer on stdout which is the maximum number of guests that can be placed in the seating arrangement under the given constraints.
## sample1
.
1
</p>