Блог пользователя Monkey_D_Luffy_1999

Автор Monkey_D_Luffy_1999, история, 9 лет назад, По-английски

I have problem with that problem http://mirror.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.

  • Проголосовать: нравится
  • -13
  • Проголосовать: не нравится

»
9 лет назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

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!

»
9 лет назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

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