#P7620. CF1431J Zero-XOR Array
CF1431J Zero-XOR Array
Background
This problem comes from Kotlin Heroes. However, submissions in other languages are allowed here.
Problem Description
You are given a sequence consisting of integers, where the -th integer is . The sequence is non-decreasing, i.e., .
You need to find all sequences consisting of integers such that all of the following conditions hold:
-
().
-
is non-decreasing.
-
( denotes the bitwise XOR operation. In Kotlin, it is represented by the function
xor).
Compute the number of different sequences modulo .
Input Format
The first line contains two integers , indicating that .
The second line contains integers .
Output Format
Output one line with one integer, the answer modulo .
3 2
0 1 3
2
4 3
0 3 6 7
6
5 5
1 5 9 10 23
20
10 7
39 62 64 79 81 83 96 109 120 122
678132
Hint

Translated by ChatGPT 5