XperiOA #1
Count Integer Sequences
Estimated HardJudge-ready
Topics (AI-labelled)Bits & MathDP Basics
Count the integer sequences of length N where each element can be 0..M and the bitwise XOR of all elements equals X. Output the answer modulo 998244353. Choices at different indices make different sequences.
Input
Input N M X; this site adds 1≤N≤100, 0≤M≤50, 0≤X≤63.
Output
Output the number of sequences modulo 998244353.
Example 1
Input:
1 2 0
Output:
1
Example 2
Input:
2 1 1
Output:
2
Example 3
Input:
3 4 6
Output:
12
Editorial
Loading solution…