Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

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

Автор difask, 9 лет назад, перевод, По-русски

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!

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

»
9 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

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.