#P1539. [TJOI2011] 01矩阵
[TJOI2011] 01矩阵
Description
An matrix, in which some positions are already fixed. Positions marked '.' can be filled with or . Count the number of matrices for which the difference between any two adjacent positions is (i.e., adjacent cells sharing a side have different values), and output the answer modulo .
Input Format
The first line contains two integers .
Then follows an matrix consisting of .
Output Format
Output a single integer: the number of matrices satisfying the condition, modulo .
2 3
10.
...
5
Hint
Constraints and Conventions
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号