Hi everyone. Today I encountered a data structures problem, which is a slight swist on standart segment tree problem.
You are given an array A of size N. N ≤ 10^5, A[i] ≤ 10^6, You need to process 3 types of queries
Print the sum of all integers ai where L ≤ i ≤ R.
Add x to each integer ai where L ≤ i ≤ R.
For each integer A[i] where L ≤ i ≤ R, replace it with floor(sqrt(A[i])). Where sqrt(a) is the square root of a, and floor(b) is the integer value of b after removing everything on the right of the decimal point.
There can be Q≤20000 queries.
If we didn't have type 3 query, then we are left with standard lazy segment tree problem.
How to handle 3rd type queries?