Help

Revision en1, by TooMuchPainTheseDays, 2022-03-03 04:31:33

Can someone help me to solve this problem ?
Actually, this problem was in my brain but I didn't find it anywhere. (so I can't provide link)

Problem :


Given array of size N ( N <= 105 )
we have to perform 2 queries.
query of type 1 : 1 l r
increase the value of a[l] by 1 , a[l+1] by 2 , a[i+2] by 3 ,... a[r] by r-l+1
query of type 2 : 2 l r
print the sum of range [l,r]
Thanks in advance.
Tags segment tree, lazy propagation, queries, data structures

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English TooMuchPainTheseDays 2022-03-03 04:31:33 539 Initial revision (published)