TLE on CSES Salary Queries

Правка en1, от Orn0, 2025-01-27 17:27:48

Hello codeforcers.

I'm learning segment trees, and for now I'm focused on "standard" range query/point update segment trees. I've tried to solve CSES 1144 : Salary Queries, but I keep getting TLE.

I've written a simple segment tree struct, and I'm using coordinate compression. I suppose that I should find a constant factor optimization to pass the time limit. Is there a generic optimization I should include in my implementation to make it faster ?

I guess I could consider using more advanced segment trees variants, but I thought I could stay on a generic ST. Am I wrong ?

Code

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Orn0 2025-01-27 17:27:48 5542 Initial revision (published)