XOR Sum
Time limit1sMemory limit512 MB
Given n k-bit numbers, compute the sum over all pairs of (a_i XOR a_j) raised to the power x, modulo 998244353.
- Level
Hard8 of 10
- Topics
- Bit manipulation, Math, Combinatorics
- Solved
- No attempts yet
Problem
You have an array of -bit numbers .
Calculate .
is the bitwise exclusive OR of and .
Since the answer can be very large, output it modulo .
Input
The first line contains three integers , , (, ), the length of the array, the number of bits in each number, and the power applied to each XOR result.
Each of the next lines contains a string made of '0' and '1'. The -th string gives .
Output
Print one number: the sum of the -th powers of the XOR results over all pairs, modulo .
Hint
In the first sample, the array is , and the answer is .
In the second sample, the array is , and the answer is .