atcoder#YAHOOPROCON2019QUALE. Odd Subrectangles
Odd Subrectangles
Score : points
Problem Statement
There is a square grid with rows and columns. Each square contains an integer: or . The square at the -th row from the top and the -th column from the left contains .
Among the possible pairs of a subset of the rows and a subset of the columns, find the number of the pairs that satisfy the following condition, modulo :
- The sum of the numbers contained in the intersection of the rows belonging to and the columns belonging to , is odd.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number of the pairs of a subset of the rows and a subset of the columns that satisfy the condition, modulo .
2 2
0 1
1 0
6
For example, if consists of the first row and consists of both columns, the sum of the numbers contained in the intersection is .
2 3
0 0 0
0 1 0
8