atcoder#CF16EXHIBITIONFINALH. AB=C Problem
AB=C Problem
Score : points
Problem Statement
Snuke received two matrices and as birthday presents. Each of the matrices is an by matrix that consists of only and .
Then he computed the product of the two matrices, . Since he performed all computations in modulo two, was also an by matrix that consists of only and . For each , you are given , the -element of the matrix .
However, Snuke accidentally ate the two matrices and , and now he only knows . Compute the number of possible (ordered) pairs of the two matrices and , modulo .
Constraints
- is either or .
Input
The input is given from Standard Input in the following format:
:
Output
Print the number of possible (ordered) pairs of two matrices and (modulo ).
2
0 1
1 0
6
10
1 0 0 1 1 1 0 0 1 0
0 0 0 1 1 0 0 0 1 0
0 0 1 1 1 1 1 1 1 1
0 1 0 1 0 0 0 1 1 0
0 0 1 0 1 1 1 1 1 1
1 0 0 0 0 1 0 0 0 0
1 1 1 0 1 0 0 0 0 1
0 0 0 1 0 0 1 0 1 0
0 0 0 1 1 1 0 0 0 0
1 0 1 0 0 1 1 1 1 1
741992411