#P7447. [Ynoi2007] rgxsxrs

[Ynoi2007] rgxsxrs

Background

The input size of this problem is about 15 MB, and the output size is about 13 MB. Please choose an appropriate input/output method.

Problem Description

Given a sequence aa of length nn, you need to perform mm operations:

1 l r x: Decrease by xx all elements in the interval [l,r][l,r] that are >x> x.

2 l r: Query the sum, minimum value, and maximum value of the interval [l,r][l,r].

Input Format

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

The second line contains nn positive integers representing the sequence aa.

Then follow mm lines, each containing 33 or 44 positive integers, representing one operation.

This problem is forced online: all input l,r,xl,r,x must be XORed with lastanslastans, where lastanslastans is defined as the value of (the interval sum obtained from the previous query operation) modulo 2202^{20}. If there has been no query operation before, then it is 00.

Output Format

For each operation of type 22, output one line with three numbers separated by spaces, representing the answer.

5 5
2 4 5 1 3
1 2 4 3
2 1 5
2 10 12
1 7 3 7
2 5 3
9 1 3
6 1 3
4 1 2

Hint

Idea: wangziji & 花花 (Huahua), Solution: wangziji & 花花 (Huahua), Code: ccz181078, Data: wangziji & 花花 (Huahua) & ccz181078.

Note: This problem uses bundled testing. Only after you pass all test points in a subtask can you get the score for that subtask.

For 1%1\% of the testdata, n,m1000n,m\leq 1000, and the time limit is 3 s.

For another 14%14\% of the testdata, ai10a_i\leq 10, n,m2×105n,m\leq 2\times10^5, and the time limit is 3 s.

For another 19%19\% of the testdata, ai1000a_i\leq 1000, n,m2×105n,m\leq 2\times10^5, and the time limit is 3 s.

For another 19%19\% of the testdata, ai2×105a_i\leq 2\times 10^5, n,m2×105n,m\leq 2\times10^5, and the time limit is 3 s.

For 100%100\% of the testdata, 1n,m5×1051\le n,m\leq 5\times 10^5, 1ai,x1091\leq a_i,x\leq 10^9.

Translated by ChatGPT 5