P27506 [AtCoder] Odd Subrectangles
提高+
题目描述

Problem Description

There is a grid with $ N $ rows and $ M $ columns. Each cell contains either an integer $ 0 $ or $ 1 $, where the integer in the $ i $-th row and $ j $-th column is $ a_{ij} $.

Among the $ 2^{N+M} $ pairs of subsets of rows $ A $ and columns $ B $, find the number of pairs that satisfy the following condition, modulo $ 998244353 $.

  • The sum of the integers in the $ |A||B| $ cells at the intersection of the rows in $ A $ and the columns in $ B $ is odd.

Input Format

The input is given from the standard input in the following format:

$ N $ $ M $ $ a_{11} $ $ ... $ $ a_{1M} $ $ : $ $ a_{N1} $ $ ... $ $ a_{NM} $

Output Format

Output the number of pairs of subsets of rows $ A $ and columns $ B $ that satisfy the condition, modulo $ 998244353 $.

Sample Input and Output

Sample Input #1

2 2
0 1
1 0

Sample Output #1

6

Sample Input #2

2 3
0 0 0
0 1 0

Sample Output #2

8

Notes/Hints

Constraints

  • $1 \leq N, M \leq 300$
  • $0 \leq a_{i,j} \leq 1$ (for $1 \leq i \leq N, 1 \leq j \leq M$)
  • All inputs are integers.

Sample Explanation 1

For example, if $ A $ is chosen to be only the first row and $ B $ is chosen to be the first and second columns, the sum of the integers in the intersecting cells is $ 0 + 1 = 1 $.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 2 0 1 1 0
样例输出
6