DONT CLICK IF YOU'RE <=1400 rating

Revision en1, by StellarSpecter, 2024-06-25 13:19:32

Help me solve this problem please ->

**** **** There is an array of n elements, initially filled with zeros. You need to write a data structure that processes two types of queries: assign value v to all elements on the segment from l to r−1, find the sum on the segment from l to r−1.

Input

The first line contains two numbers n and m (1≤n, m≤100000), the size of the array and the number of operations. The following lines contain the description of the operations. The description of each operation is as follows: 1 l r v: assign value v to all elements on the segment from l to r−1 (0≤l<r≤n, 0≤v≤109). 2 l r: find the sum on the segment from l to r−1 (0≤l<r≤n).

Output

For each operation of the second type, print the corresponding value.

Tags segment tree, lazy propagation

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English StellarSpecter 2024-06-25 13:19:32 808 Initial revision (published)