CSES: Salary Queries Solution using Dynamic Segment Tree

Revision en1, by sajidali6567, 2023-11-28 14:26:17

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

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)