#P10148. [Ynoi1999] M47升级型“钢铁阿诺”

[Ynoi1999] M47升级型“钢铁阿诺”

Background

Problem Description

Given an integer sequence a1,,ana_1,\dots,a_n of length nn.

You are also given a sequence of mm operations, numbered from 11 to mm. The operations include update operations and range sum operations. An update operation gives l,r,vl,r,v and sets al,al+1,,ara_l,a_{l+1},\dots,a_r to vv. A range sum operation gives l,rl,r and asks for i=lrai\sum\limits_{i=l}^r a_i.

There are qq queries. Each query gives L,RL,R and asks: after initializing the sequence aa to 00, execute operations L,L+1,,RL,L+1,\dots,R in order, and output the sum of the answers of all range sum operations during this process.

Input Format

The first line contains three integers n,m,qn,m,q.

The next mm lines each describe one operation in the form 1,l,r,v1,l,r,v or 2,l,r2,l,r.

The next qq lines each contain two integers L,RL,R, describing one query.

Output Format

Output qq lines. Each line contains one integer, in order, representing the answer to each query.

10 5 4
1 9 10 7
1 7 10 9
2 3 10
1 10 10 1
2 5 10
2 5
1 1
3 4
1 3
64
0
0
36

Hint

Idea: Ynoi, Solution: nzhtl1477&ccz181078, Code: ccz181078, Data: ccz181078.

Constraints: for all testdata, 1lrn1\le l\le r\le n, 1vn1\le v\le n, 1LRm1\le L\le R\le m, and 1n,m,q5×1051\le n,m,q\le 5\times 10^5.

For 10%10\% of the testdata, n,m,q102n,m,q\le 10^2.

For another 20%20\% of the testdata, n,m,q5×103n,m,q\le 5\times 10^3.

For another 10%10\% of the testdata, every operation is a range sum operation.

For another 20%20\% of the testdata, every query satisfies L=1L=1.

For another 20%20\% of the testdata, n,m,q2×105n,m,q\le 2\times 10^5.

For the remaining testdata, there are no special constraints.

Translated by ChatGPT 5