rguy23's blog

By rguy23, history, 30 hours ago, In English

Hi everyone, I was trying to solve this problem. You can find my code here. My complexity is $$$O(N \cdot log^2(N))$$$.

However, I am getting TLE. Can someone please help in optimizing my code? I have written appropriate comments in the DFS function. For LCA and Centroid Decomposition, I referred to this blog and took the code from here.

Please help.

  • Vote: I like it
  • +3
  • Vote: I do not like it