luogu#P1539. [TJOI2011] 01矩阵

    ID: 530 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>动态规划 DP2011各省省选快速沃尔什变换 FWT天津状压 DP

[TJOI2011] 01矩阵

Problem Description

An n×mn \times m 0101 matrix, in which some positions are already fixed. Positions marked '.' can be filled with 00 or 11. Count the number of matrices for which the difference between any two adjacent positions is 11 (i.e., adjacent cells sharing a side have different values), and output the answer modulo 1000710007.

Input Format

The first line contains two integers n,mn, m.

Then follows an n×mn \times m matrix consisting of 0,1,.\verb!0!,\verb!1!,\verb!.!.

Output Format

Output a single integer: the number of matrices satisfying the condition, modulo 1000710007.

2 3
10.
...

5

Hint

Constraints and Conventions

For 100%100\% of the testdata, n×m225n \times m \le 225.

Translated by ChatGPT 5