P26979 [AtCoder] XOR Puzzle
提高-
题目描述

Problem Description

square1001 received a sequence \( a \) of length \( n \) from Atcoder Inc. All elements of \( a \) are distinct.
He created a sequence \( b \), but he doesn't remember it. However, he remembers the following:
- All elements of \( b \) are distinct.
- All elements of \( b \) are also in \( a \).
- square1001 likes binary numbers, so he remembers that \( b_1 \oplus b_2 \oplus \cdots \oplus b_r = k \) (where \( r \) is the length of sequence \( b \)). [\( \oplus \) denotes XOR]

square1001 decided to think about how many possible sequences \( b \) could be.
However, he was about to do a full search, and you noticed this. You decided to find the answer for him.
How many possible sequences \( b \) are there?
Since the answer can be very large, output it modulo \( 1,000,000,007 \).

Input Format

The input is given from the standard input in the following format:

\( n\ k \) \( a_1\ a_2\ \cdots\ a_n \)

  • The first line contains the length of sequence \( a \) \( n \) and the XOR value \( k \) of sequence \( b \), separated by spaces.
  • The second line contains the elements of sequence \( a \) separated by spaces.

Output Format

Output should follow the standard output in the following format:

  • Output the number of possible sequences \( b \) in one line.
  • Output the result modulo \( 1,000,000,007 \).

Sample Input and Output

Sample Input #1

3 1
1 2 3

Sample Output #1

3

Sample Input #2

3 10
8 7 5

Sample Output #2

6

Sample Input #3

25 127
5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125

Sample Output #3

235924722

Notes/Hints

Constraints

  • \( 1 \le n \le 100 \)
  • \( 1 \le a_i, k \le 255 \)
  • \( i \neq j \Rightarrow a_i \neq a_j \)

Subtasks

Subtask 1 \[ 50 points \]

  • \( 1 \le n \le 4 \)

Subtask 2 \[ 170 points \]

  • \( 1 \le n \le 20 \)

Subtask 3 \[ 180 points \]

  • \( 1 \le n \le 100 \)

Sample Explanation 1

Possible sequences \( b \) are \( b = \{ 1 \}, \{ 2, 3 \}, \{ 3, 2 \} \), totaling 3.

Sample Explanation 2

Possible sequences \( b \) are \( b = \{ 5, 7, 8 \}, \{ 5, 8, 7 \}, \{ 7, 5, 8 \}, \{ 7, 8, 5 \}, \{ 8, 5, 7 \}, \{ 8, 7, 5 \} \), totaling 6.

Sample Explanation 3

Output the result modulo \( 1,000,000,007 \).

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 1 1 2 3
样例输出
3