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: 1. get and update query is log(O(max_value)) which is log(10^9) = 30. 2. There could be 2 * 10^5 queries, so total is 2 * 10^5 * 30 = 6 * 10^6 3. update query is run on input array elements 30 * 2 * 10^5 = 6 * 10^6 4. Total Complexity is 2 *(6 * 10^6) = 1.2 * 10^7
Problem Link: https://cses.fi/problemset/task/1144 Code Link: https://ideone.com/pKCqoP