Why TLE?

Revision en1, by 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.

Tags segment trees, range query, trees

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Ssaranshh13 2022-12-28 14:33:37 483 Initial revision (published)