Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Why TLE?

Правка en1, от Ssaranshh13, 2022-12-28 14:33:37

Link to the problem : CSES- Subset Queries In the problem, I flattened the tree and used Euler tours to access subtrees, and used a segment tree to answer the queries on the subtrees. The solution's overall time complexity should be O(nlogn). But it's giving TLE on a larger value of n.

My submission: Click here

Please tell me where I am doing this wrong. Thank you in advance.

Теги segment trees, range query, trees

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Ssaranshh13 2022-12-28 14:33:37 483 Initial revision (published)