Monkey_D_Luffy_1999's blog

By Monkey_D_Luffy_1999, history, 8 years ago, In English

I have problem with that problem http://codeforces.com/contest/459/problem/E
Could someone please help me to find my fault, it gives wrong answer on test 36
I solved it with dp here is my solution link
Thanks in advance.

»
8 years ago, # |
  Vote: I like it +4 Vote: I do not like it

your code gives wrong answer for this test: 8 7 1 2 1 2 3 2 3 4 3 4 5 4 4 6 3 6 7 4 7 8 5 pay attention when you sort an array of pairs if first elements were equal it sorts them according to the second element. in your code when two edges have equal wi then it add the edge which has bigger uito the current graph and it may cause problem like the example I told!

»
8 years ago, # |
  Vote: I like it +4 Vote: I do not like it

i meant w [i] and u [i] in my previous comment which they are equal to v [i].ff and v [i].sf in your code. :)