1495. Kera’s line segment

Kera likes line segments. He has nn line segments, and each line segment can be described by lil_i and rir_i on the number axis. Moreover, each line segment Kera has its preferred value valival_i.

Then there are mm operations:

  • (op=1,li,ri,vali)(op = 1, l_i, r_i, val_i) — Add a line segment (li,ri,vali)(l_i,r_i,val_i) on the number axis, according to the above.
  • (op=2,L,R)(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][L, R].

In addition, a line segment (li,ri,vali)(l_i, r_i, val_i) fully contained by the interval (L,R)(L,R) means: LliriRL \leq l_i \leq r_i \leq R.

输入

The first line contains two integer nn and mm.

Each of the next nn lines contains 33 integers li,ril_i , r_i and valival_i.

Each of the next mm lines contains 44 integers (op=1,ai,bi,vali)(op = 1, a_i, b_i, val_i) or 33 integers (op=2,A,B)(op = 2,A,B).

Specifically, in order to get the real input, you need to create a variable named LastAns\text{LastAns} with an initial value of 00.

For each operation (op=1)(op = 1), li=aixorLastAns,ri=bixorLastAnsl_i = a_i xor \text{LastAns}, r_i = b_i xor \text{LastAns}.

For each operation (op=2)(op = 2), L=AxorLastAns,R=BxorLastAnsL = A xor \text{LastAns}, R = B xor \text{LastAns}, then LastAns\text{LastAns} updated to result of this query.

In addition, xor means binary exclusive OR.

1n,m100000,1liri3000,0vali1e9,1LR30001 \leq n, m \leq 100000, 1\leq l_i \leq r_i \leq 3000, 0 \leq val_i \leq 1e9, 1\leq L \leq R \leq 3000.

输出

For each operation (op=2)(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

来源

2021 GDCPC 广东省大学生程序设计竞赛

登录以提交代码。
单点时限 2 秒
内存限制 1024 MB
提交 29
通过 5