Hi everyone,
I am trying to solve salary queries from CSES using Dynamic Segment Tree. But I am getting TLE.
My understanding of time complexity is: get and update query is log(O(max_value)) which is log(10^9) = 30. There could be 2 * 10^5 queries, so total is 2 * 10^5 * 30 = 6 * 10^6 and update query is run on input array elements 30 * 2 * 10^5 = 6 * 10^6 so total Complexity is 2 *(6 * 10^6) = 1.2 * 10^7
Problem Link: https://cses.fi/problemset/task/1144 Code Link: https://ideone.com/QfRtXB