#P2595. [ZJOI2009] 多米诺骨牌
[ZJOI2009] 多米诺骨牌
Description
There is an rectangular grid with some cells blocked by obstacles. You need to place some or dominoes on this grid so that any two dominoes do not overlap, and no domino covers an obstacle. Moreover, for every pair of adjacent rows, there must be at least one domino crossing them; similarly, for every pair of adjacent columns, there must be at least one domino crossing them. Find the number of different placement methods. Note that you do not need to cover all unobstructed cells.
Input Format
The first line contains two integers .
The next lines each contain characters describing the grid. Character x means the cell has an obstacle, and character . means the cell is empty.
Output Format
Output a single integer: the number of different placements modulo .
3 3
...
...
...
2
Hint
Sample explanation:
Two valid placements are:
112 411
4.2 4.2
433 332
Note that the digits are only used to distinguish dominoes; different labelings do not represent different solutions.
Constraints:
- For of the testdata, .
- For of the testdata, .
- For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号