XOR Determinant
Time limit1sMemory limit1024 MB
Given arrays b and c, find the determinant mod 998244353 of the n by n matrix whose entries are b_i XOR c_j.
- Level
Medium7 of 10
- Topics
- Math, Matrix, Bit manipulation
- Solved
- No attempts yet
Statement
You are given two arrays and of length , each containing non-negative integers. Build the matrix with . Find the determinant of modulo .
Input
Each test contains multiple test cases. The first line contains an integer (), the number of test cases. Each test case starts with a line containing (). The next line contains (), and the line after that contains (). The sum of over all test cases does not exceed .
Output
For each test case, print the determinant of modulo on its own line.
Hint
First test case: . Second test case: the matrix is , so . Modulo , this is . Third test case: expands to Modulo , becomes .