Sumanto's blog

By Sumanto, 4 years ago, In English

https://cses.fi/problemset/task/1669/ I was solving this problem and my simple approach to detect the cycle is to store the current path in a vector and when i encounter a duplicate in cycle, I print it. But Issue is 3 test cases are giving me WA out of 20. Also test cases are really huge to debug the issue with my code. Any help will be thankful

My Submission
  • Vote: I like it
  • 0
  • Vote: I do not like it

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

Try this case...

4 4

1 2

1 3

3 4

1 4

Hope now you can debug your code yourself :)

»
21 month(s) ago, # |
  Vote: I like it 0 Vote: I do not like it
Code similar

It passed all testcase !!