Hey guys i need help for solving this problem :
http://codeforces.me/problemset/problem/369/C
my idea was it's better to choose leaves of the tree because if there is a way that is the best and a node is chosen that is not a leave u can continue your way from this node down to the leave and the answer wont decrease
so i put a counter on bad edges and when ever i reached a leaf and the counter is not zero i add the leave to answer
my submission : http://codeforces.me/contest/369/submission/12994706
i dont know what is wrong with this please help !
This Example:
6 5
1 2 2
2 3 2
3 4 2
3 5 1
4 6 1
Your output is:
1
5
But then the 3-4 road wouldn't be repaired...
tanx !