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

Автор Peace_789, история, 4 года назад, По-английски

Hello Everyone ...

Today I was solving this problem ... Problem statement : You are given a directed weighted graph, and your task is to find out if it contains a negative cycle, and also give an example of such a cycle.

I am aware of solving this problem using Bellman Ford's Algorithm , But I am trying another approach which is giving me WA in 1 Test Case (total 13 is there) .

So , Can anyone point out whether this approach is correct or not ... and If it is correct then suggest me some modification otherwise give some counter examples where this code might fail.

code

Thanks in advance :) and sorry for my bad english.

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

»
4 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится
Remember to format your code

Also, can you provide the original link?