4587: K

内存限制:128 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:Special Judge 上传者:
提交:0 通过:0

题目描述


Kera likes line segments. He has n line segments, and each line segment can be described by li and ri on the number axis. Moreover, each line segment Kera has its preferred value vali.

Then there are m operations:

• (op = 1, li , ri , vali) — Add a line segment(li , ri , vali) on the number axis, according to the above.

• (op = 2, L, R) — Query the maximum difference of preferred values of all line segments that are fully contained by the interval represented by [L, R].

In addition, a line segment(li , ri , vali) fully contained by the interval(L, R) means: L ≤ li≤ ri ≤ R



输入格式

The first line contains two integer n and m.

Each of the next n lines contains 3 integers li, ri and vali.

Each of the next m lines contains 4 integers (op = 1, ai , bi , vali) or 3 integers (op = 2, A, B).

Specifically, in order to get the real input, you need to create a variable named LastAns with an initial value of 0.

For each operation(op = 1), li = ai xor LastAns, ri = bi xor LastAns.

For each operation(op = 2), L = A xor LastAns, R = B xor LastAns, then LastAns updated to result of this query.

In addition, xor means binary exclusive OR. 1 ≤ n, m ≤ 100000, 1 ≤ li ≤ ri ≤ 3000, 0 ≤ vali ≤ 1e9, 1 ≤ L ≤ R ≤ 3000.

输出格式

For each operation(op = 2) , print an integer to represent the maximum difference of preferred values. It is guaranteed that each query fully contains at least one line segment.

输入样例 复制

3 5
2 3 1
5 6 4
4 10 5
2 2 5
2 2 6
2 2 9
1 2 3 20
2 5 14

输出样例 复制

0
3
4
19

数据范围与提示

The real sample input:

3 5

2 3 1

5 6 4

4 10 5

2 2 5

2 2 6

2 1 10

1 6 7 20

2 1 10

分类标签