Hi community, I was solving the problem 593D - Happy Tree Party and I did get an accepted verdict. The problem is: my code is wrong! I don't think many people solved it the wrong way (although I found some accepted submissions with a wrong solution), but here is the simple case that breaks my code:
7 1
1 2 2
2 3 1
3 4 2
2 5 2
5 6 2
5 7 2
1 4 5 128
The answer is 32 and my code outputs 8. Here you can find my wrong successful submission: 14486336.
I hope someone can add some test cases :D! Thanks.
romanasa
Just realized my solution is wrong too :/