Codeforces and Polygon may be unavailable from December 6, 19:00 (UTC) to December 6, 21:00 (UTC) due to technical maintenance. ×

Peace_789's blog

By Peace_789, history, 4 years ago, In English

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.

  • Vote: I like it
  • -21
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it
Remember to format your code

Also, can you provide the original link?