Hello,
I am trying to solve the problem adn.cn/blog/attachments/month_07 ... 153238.pdf
Actually, I am not modifying tree, but for each vertex of rooted tree I consider it as part of the solution, or trying to find solution in one of its sub-trees.
Do you have some tricky test case, or if you are author, can you give me test case where I am wrong ? Thank you in advance.
EDIT: Now I am getting TLE It seems time is pretty strict. Here is test case that helped to find my mistake (I hope the only )
18
1 18
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 16
8 11
11 12
12 17
8 13
13 14
14 15