I don’t know why i get TLE
queries to me is every node and its k and c
my approach:
1- make a tree for every club with dummy node root
2- sort queries by c(club) then k(level)
3- iterate over queries when a new club start i make dfs with InTime and OutTime for every node
4-Now easily get the sum of the k - 1 by segment tree and add the new sums to every node
code is here: http://ideone.com/UpAy43
i know there is editorial but i dont want to open it because if my approach have any wrong assumption to try again so please don’t say a new approach in comment just say to me why i get TLE