#P5670. 秘籍-反复异或

    ID: 4212 远端评测题 500ms 256MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>枚举,暴力块状链表,块状数组,分块位运算,按位

秘籍-反复异或

Description

Given a sequence of length nn, support the following operations:

  • 1 l r x: Add xx to all elements in the interval [l,r][l, r].
  • 2 l r: Query the value of the last mm binary bits of the XOR sum of all elements in the interval [l,r][l, r].

Input Format

The first line contains three positive integers n,m,qn, m, q, representing the sequence length, the number of bits, and the number of operations.

The second line contains nn non-negative integers, representing the original sequence aia_i.

The next qq lines each contain several non-negative integers describing an operation.

Output Format

For each operation of type 2, output one line containing a non-negative integer representing the answer.

10 2 10
0 1 0 0 1 0 2 2 0 1 
2 3 9
2 1 5
1 9 9 0
1 3 7 2
1 1 6 3
2 1 10
2 6 7
2 3 6
1 3 9 2
1 3 9 3

1
0
3
1
3

Hint

Constraints
This problem has 1010 test points.

For test points 131 \sim 3, 1n,q10001 \le n, q \le 1000.
For test points 4,54, 5, 1m51 \le m \le 5.
For test points 6106 \sim 10, let kk be the test point index, then m=km = k.

For 100%100\% of the testdata, 1n,q1051 \le n, q \le 10^5, 1m101 \le m \le 10, and 0ai,x<2m0 \le a_i, x < 2^m.

Please pay attention to constant optimization.

Translated by ChatGPT 5