LIT2021015_AYUSH's blog

By LIT2021015_AYUSH, history, 2 months ago, In English

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.

Full text and comments »

  • Vote: I like it
  • -2
  • Vote: I do not like it