Hey guys!
I was having trouble solving milkvisits on the USACO gold contest. I solved it using heavy light decomposition, and I messed up on the implementation. I realize that you can solve this problem in a different, faster, and easier way, but I want to know what went wrong in my implementation. I looked at the test cases, but the smallest test case that I got a wrong answer on is of size 100, 000, so I had trouble visualizing the graph.
Here is my code, the input is in this google drive folder. I am supposed to output 1, but instead I am outputting 0. It would be of great help to me if you could tell me why my code is failing, and generally speaking, how you manage to debug problems with large inputs, if you use the inputs at all.
Thanks in advance.