In the heavy light decomposition explanation, what if the node for which we have to handle the get(v) query is heavy? In that case, the complexity would be O(number of edges from v) and not O(√n).
In the heavy light decomposition explanation, what if the node for which we have to handle the get(v) query is heavy? In that case, the complexity would be O(number of edges from v) and not O(√n).
Can anyone tell me why my code is getting a runtime error on every test case?
Thanks in advance!
I'm getting WA for the second subtask and can't spot my problem. Can someone please help me?
This is my code-