Ssaranshh13's blog

By Ssaranshh13, history, 20 months ago, In English

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.

  • Vote: I like it
  • -1
  • Vote: I do not like it

»
20 months ago, # |
  Vote: I like it 0 Vote: I do not like it

void Build(vector<ll> a,ll node, ll L, ll R)

pass a by reference