complexity analysis help

Правка en4, от Uzumaki_Narutoo, 2020-05-08 20:28:52

Hello every one ,wish you are doing great .... can any one explain how does this code doesn't got TLE ? https://codeforces.me/contest/246/submission/79394388

My idea is:

1-I'm storing all nodes in subtree of u at depth x using dfs time.

2- In every query first I check if I've encountered a query asking about the same nodes then I print answer as I save the ans of every query else then I iterate over all strings at depth d[i] + x at subtree of u and find number of distinct strings using set.

thanks in advance

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский Uzumaki_Narutoo 2020-05-08 20:28:52 345
en3 Английский Uzumaki_Narutoo 2020-05-08 20:20:24 305
en2 Английский Uzumaki_Narutoo 2020-05-08 19:24:34 6 Tiny change: 'ng great\ncan any on' -> 'ng great\n.... can any on'
en1 Английский Uzumaki_Narutoo 2020-05-08 19:23:33 199 Initial revision (published)