#P11016. XOR Pairs
XOR Pairs
Background
Every day, CT only hums the blues in London and wanders around in front of the school leaders. This lazy and carefree life makes him very down, so he decides to turn over a new leaf and study mathematics.
Problem Description
CT is working on a math problem.
CT has a sequence of length . Now operations are given. For each operation:
- Change to .
- After the modification, find the number of valid ordered pairs in the array.
Note: For a pair with that satisfies , we call it a valid pair. Here denotes bitwise XOR, and denotes the larger one of and .
Input Format
The first line contains two integers .
The second line contains integers, representing the sequence .
The next lines each contain two integers , representing an operation that changes to .
Output Format
For each operation:
Output one integer representing the required answer.
6 4
1 1 4 5 1 4
1 2
4 3
5 2
6 5
9
10
10
9
Hint
Constraints
For all testdata, it is guaranteed that , , , , .
| Score | Special Properties | |||
|---|---|---|---|---|
| None | ||||
Translated by ChatGPT 5