Under construction

Still being built. Things may change

Queries and Queries

Time limit2.5sMemory limit1024 MB

Summary
Given an array and M range-XOR updates, answer queries that XOR a range of update values by v and queries that XOR a range of the final array.
Level

Hard8 of 10

Topics
Segment tree, Bit manipulation, Prefix sum, Array
Solved
No attempts yet

Problem

You are given an array A1,A2,…,ANA_1, A_2, \ldots, A_N of size NN. Apply the following update operation MM times to this array. Here ⊕\oplus is the bitwise XOR operation.

  • ll rr xx: For every AiA_i with l≤i≤rl \le i \le r, execute Ai=Ai⊕xA_i = A_i \oplus x.

Write a program that answers the following queries.

  • 1 LL RR vv: For every ii with L≤i≤RL \le i \le R, execute xi=xi⊕vx_i = x_i \oplus v. Here xix_i is the value of xx in the ii-th update.
  • 2 ss ee: Print As⊕As+1⊕⋯⊕AeA_s \oplus A_{s+1} \oplus \cdots \oplus A_e in the array after all MM update operations have been applied.

Input

The first line contains NN, MM, and QQ, separated by spaces. (1≤N,M,Q≤1051 \le N, M, Q \le 10^5)

The second line contains A1A_1 through ANA_N, separated by spaces. (0≤Ai≤1090 \le A_i \le 10^9)

The next MM lines each contain three integers ll, rr, and xx, in that order. (1≤l≤r≤N1 \le l \le r \le N, 0≤x≤1090 \le x \le 10^9)

The next QQ lines each contain a query, which is either 1 LL RR vv or 2 ss ee. (1≤L≤R≤M1 \le L \le R \le M, 0≤v≤1090 \le v \le 10^9, 1≤s≤e≤N1 \le s \le e \le N)

Output

For each query of type 2, print the answer on its own line.

Examples1

  1. Example 1

    Input
    9 8 9
    22 2 20 6 20 3 22 28 7
    6 9 11
    3 6 9
    3 4 14
    4 9 30
    2 4 30
    2 7 22
    4 7 5
    1 7 29
    2 2 9
    2 4 5
    1 5 6 2
    1 1 8 22
    2 2 4
    2 1 3
    2 4 6
    1 4 5 7
    2 1 3
    
    Expected output
    20
    2
    8
    12
    19
    12