I want to know why my solution to xormin using trie and segment-tree is not get accepted ?
Because number of queries are too many and O(N*log(n)*20 + Q*log(n)*20) won’t pass in 2 secs.
Try reducing it to O(N*log(n)*20 + Q*20)
so what should be the approach ?
different root for each node on given tree…
You don’t need segment tree…
After thinking a lot, I exactly thought of a solution with persistent tries. But it kept giving me RE.
Then I thought to try a brute force but then it also gave me RE and then WA. I still could not find out the mistake in my brute force solution. I request you to look into it once.
Thanks in advance…