Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

difask's blog

By difask, 9 years ago, In English

I have problem with implementing this algorithm. I know how to implement it if graph doesn't contain multiple edges and self edges. But now I'm trying with them. I know it's not hard. But it gives me WA. I don't know why. My code . Please help!!! Thanks!

  • Vote: I like it
  • +1
  • Vote: I do not like it

»
9 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

You have:

if(to == p)
  continue;

It gives WA when

2 2
1 2
1 2

// There are no bridges

UPD: Suggestion just check by edge id.