_Ramtin_'s blog

By _Ramtin_, history, 9 years ago, In English

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 !

  • Vote: I like it
  • +5
  • Vote: I do not like it

»
9 years ago, # |
  Vote: I like it +6 Vote: I do not like it

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...