luogu#P3794. 签到题IV
签到题IV
Background
It seems the other problems in this monthly contest have long backgrounds, so this one will skip the background. 
Problem Description
Given a sequence of length , , where each number is a positive integer.
You need to find how many pairs satisfy and $\gcd(a_i, a_{i+1}, \ldots, a_j) \operatorname{xor} (a_i \operatorname{or} a_{i+1} \operatorname{or} \cdots \operatorname{or} a_j) = k$, where denotes bitwise XOR and denotes bitwise OR.
Input Format
The first line contains two integers and .
The second line contains integers .
Output Format
Output the number of valid pairs .
5 6
2 4 3 4 2
8
Hint
- For of the testdata, .
- For of the testdata, .
- For of the testdata, .
Translated by ChatGPT 5