Needed Help with a problem I m stuck on.

Revision en1, by LIT2021015_AYUSH, 2024-07-14 21:21:12

Here we are given an array of size n (n<=1e5) and we are given to process q (q<=1e5) queries. Queries are of two types .The first one is a point update query. The second one tell us to calculate sum of all subarrays in the range (l to r) . More formarlly in second type of query we are given l and r and we have to find Σf(i,j) where l<=i<=j<=r and f(i,j) denotes the sum of subarray starting at i th index and ending at j th index.

Although I tried it using segment Tree but couldn't think of the optimal approach for this.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English LIT2021015_AYUSH 2024-07-14 21:21:12 581 Initial revision (published)