#P8264. [Ynoi Easy Round 2020] TEST_100

[Ynoi Easy Round 2020] TEST_100

Problem Description

Given a sequence aa of length nn, each position represents a transformation x=xaix = |x - a_i|. For each query, you are given an interval [l,r][l, r] and a value vv. Let ii go from ll to rr in order, visit each element aia_i, and update vv to vai|v - a_i|. Find the value of vv after all transformations.

Input Format

The first line contains two integers n,mn, m.

The second line contains nn integers separated by spaces, representing the sequence aa.

The next mm lines each contain three integers l,r,vl, r, v separated by spaces, representing a query.

This problem is forced online: all input values l,r,vl, r, v must be XORed with the answer of the previous query. If there was no previous query, then XOR with 00.

Output Format

For each query, output one integer per line, representing the answer.

5 5
4 5 2 5 3
3 5 3
3 3 0
5 0 6
5 0 5
6 0 4
1
4
4
5
1

Hint

Idea: nzhtl1477, Solution: nzhtl1477&ccz181078, Code: nzhtl1477, Data: nzhtl1477&
FutaRimeWoawaSete

Sample explanation:

In the first query, 33 is transformed in order by values 2,5,32, 5, 3, becoming 1,4,11, 4, 1, so the answer is 11.

After decryption, the second query is interval [2,2][2, 2] with value 11.

In the second query, 11 is transformed in order by value 55, becoming 44, so the answer is 44.

After decryption, the third query is interval [1,4][1, 4] with value 22.

In the third query, 22 is transformed in order by values 4,5,2,54, 5, 2, 5, becoming 2,3,1,42, 3, 1, 4, so the answer is 44.

After decryption, the fourth query is interval [1,4][1, 4] with value 11.

In the fourth query, 11 is transformed in order by values 4,5,2,54, 5, 2, 5, becoming 3,2,0,53, 2, 0, 5, so the answer is 55.

After decryption, the fifth query is interval [3,5][3, 5] with value 11.

In the fifth query, 11 is transformed in order by values 2,5,32, 5, 3, becoming 1,4,11, 4, 1, so the answer is 11.

Constraints:

For 100%100\% of the testdata, 1n,m,ai,v1051 \le n, m, a_i, v \le 10^5, and 1l,rn1 \le l, r \le n.

Translated by ChatGPT 5