CSES: Salary Queries Solution using Dynamic Segment Tree

Revision en3, by sajidali6567, 2023-11-28 14:38:16

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, and 2 update is done in case of update. so total is 2 * 10^5 * 30 * 2 = 12 * 10^6 and update query is run on input array elements 30 * 2 * 10^5 = 6 * 10^6 so total Complexity is 3 *(6 * 10^6) = 1.8 * 10^7

Problem Link: https://cses.fi/problemset/task/1144 Code Link: https://ideone.com/QfRtXB

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English sajidali6567 2023-11-28 14:38:16 51
en2 English sajidali6567 2023-11-28 14:30:37 36
en1 English sajidali6567 2023-11-28 14:26:17 571 Initial revision (published)