You are given an arr (len(arr) <= 1e5) (-1e9 <= arr[i] <= 1e9) and q (<= 1e5) queries, now each query is of the form, (l, r, x) (1 <= l <= r <= len(arr), x can be any 32 bit integer) for each query u need to output the sum(arr[i]) such that l <= i <= r and arr[i] >= x.
I am stuck with this problem can anyone solve this problem?








Auto comment: topic has been updated by lohitpt252003 (previous revision, new revision, compare).
sort the queries to the decreasing of x and sort the array decreasing and use segment tree (ofc you need to save the original index of the queries and the array).
Can u please write the code?
I think this should work.
On the test:
It prints:
ty
https://ideone.com/HHuZe5
why u so good bro