luogu#P5159. WD与矩阵
WD与矩阵
Background
WD spends all day immersed in matrices and cannot get out of it.
Problem Description
WD likes matrices very much, especially 01 matrices.
One day, CX gave WD a huge -row, -column 01 matrix. WD found that the XOR value of every row and every column of this matrix is .
CX then asked, “WD, do you know how many 01 matrices have XOR value in every row and every column!?” WD of course does not know this, so he came to ask you.
Since the answer may be very large, you only need to output the result modulo .
Input Format
The first line contains an integer , which represents the number of test cases.
In the next lines, each line contains two integers , representing the number of rows and columns in the query.
Output Format
Output lines. Each line contains one integer, the answer modulo .
2
2 2
2 2018
2
851481696
Hint
- Subtask 1 (11 pts): .
- Subtask 2 (43 pts): .
- Subtask 3 (46 pts): .
Translated by ChatGPT 5