Simple statement. You have a 1-indexed array with
1 p x
: change indexp
tox
, where2 l r
: perform the OR bitwise operation on all pairs froml
tor
, inclusive, then sum them3 l r
: perform the AND bitwise operation on all pairs froml
tor
, inclusive, then sum them4 l r
: perform the XOR bitwise operation on all pairs froml
tor
, inclusive, then sum them
Input Specification
The first line will contain
The second line will contain
The next
For 30% of the points,
Output Specification
For each query from 2 to 4, output the sum.
Sample Input 1
Copy
6 1
4 4 8 10 4 6
2 3 6
Sample Output 1
Copy
70
Explanatioin
For the query from
So the total sum is
Comments