How to handle this range query problem??

Revision en1, by Lakh, 2018-05-31 06:06:58

Given an array of N(N<=10^5) elements and -10^9<=A[i]<=10^9. Q(Q<=10^5) queries are there of two types:

  1. L R K: Add K to all numbers in range [L,R] in array.
  2. L R: Find no. of positive elements>0 in range [L,R].

I Thought of segment tree with lazy propagation but not able to understand what info to be stored in each node. Please suggest some approach for this problem.

Tags array, segment-tree, queries

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Lakh 2018-05-31 06:06:58 421 Initial revision (published)