Doubt in Sliding Window Median CSES problem

Revision en1, by Surge226, 2024-07-03 19:58:00

Hello everyone, I am trying to do Sliding Window Median problem from CSES. I have thought of multiset approach which is pretty close to one of its solutions and wrote this peice of code.

My Code

When I ran it on larger test case, it is taking this much time.

real    0m50.343s
user    0m50.003s
sys     0m0.195s

And, on the running the USACO solution, following same approach.

USACO solution

It is taking this much time.

real    0m1.396s
user    0m1.178s
sys     0m0.214s

Now, I am not able to understand that why the time taken is increasing so drastically, even though the complexities are same. I can share the complete code also if it would help. Thanks

Tags sliding window, cses

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Surge226 2024-07-03 19:58:00 2661 Initial revision (published)