首页 > 试题广场 >

Fluorescent 2

[编程题]Fluorescent 2
In ICPCCamp, there are n switches and m bulbs.The m bulbs are ON at the beginning.
Bobo knows in advance an n x m binary matrix Ci, j. When the i-th switch is pressed, all the bulbs j satisfying Ci, j = 1 flip its state between ON and OFF.
Let f(S) be the number of bulbs staying ON after the switches in set S is pressed. Find the sum of f(S)3 (cubic of f(S)) modulo (109+7) over all 2n possible choices of S.

输入描述:
The input consists of several test cases and is terminated by end-of-file.
The first line of each test case contains two integers n and m.
The i-th of the following n lines contains m integers Ci, 1, Ci, 2, ..., Ci, m.


输出描述:
For each test case, print an integer which denotes the result.
示例1

输入

2 2
01
10
2 3
110
011

输出

10
30

说明

For the first sample, there are 22 = 4 choices of S.
* S = \emptyset, f(S) = 2, f(S)^3 = 8.
* S = {1}, f(S) = 1, f(S)^3 = 1.
* S = {2}, f(S) = 1, f(S)^3 = 1.
* S = {1, 2}, f(S) = 0, f(S)^3 = 0.
Thus, the result is 8 + 1 + 1 + 0 = 10.

备注:
* 1 ≤ n ≤ 50
* 1 ≤ m ≤ 1000
* Ci, j ∈ {0, 1}
* The number of test cases does not exceed 500.
* The number of test cases with m > 50 does not exceed 1.
头像 牛客236655510号
发表于 2025-10-09 21:15:29
C - Fluorescent 2 首先将三次方转化一下,设进行操作后,第 个位置的开关情况为 ( 表示关, 表示开),那么三次方就变成了: 再转化一下: 对三项分别计算即可。 先计算第一项,枚举每一项 ,发现这时只和字符串第 列有关,如果该列全为 ,则方案数为 。 接下来考虑存在至少一个 展开全文