|
|
вернуться в форумПоказать все сообщения Спрятать все сообщения0) AC solve is DP on tree. 1) In DP inf = 1e9. 2) All test in the forum: 5 5 3 1 1 4 1 10 2 3 20 3 5 20 ans = 21 7 4 1 2 10 1 3 20 2 4 30 2 5 0 3 6 0 3 7 40 ans = 100 4 1 1 2 1 1 3 2 2 4 3 ans = 2 5 1 1 2 1 1 5 0 2 3 0 2 4 0 ans = 1 7 3 1 2 1 1 3 39 2 4 40 2 5 40 3 6 39 3 7 39 ans = 117 5 2 1 3 1 1 4 10 2 3 20 3 5 20 ans = 21 Edited by author 12.05.2008 19:54 thanks a lot for your test cases! Thank you for test data. I suppose there is typo in case #1. Correct answer must be 51. Why in the first example ans=21? I think it must be 51. Why in the first example ans=21? I think it must be 51. First test is incorrect. Q must be <=N-1. I could AC all your tests, but I still got WA. My falt was that my inf was too litlle ^^ thx a lot! 吃粪汁啦 第一组和第三组数据吃粪一样的。。。第一组很明显不可能啦 第三组这叫一个苹果“二叉”树 Edited by author 03.12.2011 06:51 Edited by author 03.12.2011 06:51 3-rd test case is incorrect, because "any biparous branch splits up to exactly two new branches" Remember that the tree should always be a tree (you can't split it into several components)... are you sure i think 5 5 mean we must have all vertex ans ans is 51 5 5 3 1 1 4 1 10 2 3 20 3 5 20 ans = 51 |
|
|