luogu#P7983. [JRKSJ R3] practiceZ

    ID: 7191 远端评测题 2000~7000ms 256MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>2021颜色段均摊(珂朵莉树 ODT)洛谷原创O2优化分块

[JRKSJ R3] practiceZ

Background

Problem Description

Qinqin gives you two sequences aa and bb of length nn. You need to support a total of mm operations of three types:

  1. 1 l r x: Set all numbers in the interval [l,r][l,r] of sequence aa to xx.
  2. 2 l r y: Set all numbers in the interval [l,r][l,r] of sequence bb to yy.
  3. 3 l r: Compute i=lrj=1biaj\sum_{i=l}^r \sum_{j=1}^{b_i} a_j. The answer is taken modulo 2322^{32}.

Input Format

All inputs are integers.

Line 11 contains two numbers n,mn,m.
Line 22 contains nn numbers representing sequence aa.
Line 33 contains nn numbers representing sequence bb.
The next mm lines each contain one operation. The format is the same as in the problem description.

Output Format

For each operation of type 33, output one integer per line as the answer.

4 5
5 5 4 5
3 4 4 1
2 3 3 2
2 2 3 4
3 1 4
1 3 3 2
3 2 4
57
39
5 5
1 7 5 2 5
2 1 5 3 2
1 5 5 3
1 3 5 2
3 1 4
2 1 4 2
3 1 3
33
24
10 10
27 29 12 16 16 6 20 22 17 1
2 6 1 10 4 1 3 10 9 6
2 3 5 6
3 2 10
2 5 10 9
3 5 9
1 1 5 24
1 6 10 12
3 2 3
1 4 6 14
1 4 8 14
3 5 10
956
825
264
924

Hint

This problem uses bundled judging.

Note: The original time limit was 5 s. Since it was rather strict on constant factors, it was changed by the admins to 7 s.

Subtask\text{Subtask} nn\le mm\le Special property Score Dependencies Time limit
11 500500 10310^3 None 1010 None 2s2\text{s}
22 10410^4 11
33 10510^5 3030 1,21,2 4s4\text{s}
44 5×1055\times 10^5 3×1053\times 10^5 Random testdata 2020 None 5s5\text{s}
55 None 3030 1,2,3,41,2,3,4

For 100%100\% of the data, 1n5×1051\le n\le 5\times 10^5, 1m3×1051\le m\le 3\times 10^5, 1ai,x1091\le a_i,x\le 10^9, 1bi,yn1\le b_i,y\le n.

Translated by ChatGPT 5