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

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

Автор sidchelseafan, история, 9 лет назад, По-английски

Hello,

I was trying this problem 510C - Лиса и имена, basically it asks us to do a topological sort on a DAG. I used a modified

DFS to do that — 11664540.

I do a DFS to check for a cycle, then I do a topological sort on the DAG if there are no cycles. But I was getting

WA 12th case. I tried reading others' solutions but couldn't find what was wrong with my code. I then used an O(V^2)

topological sort and it passed. Can someone point my mistake. Thanks , Help much appreciated :)

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

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

Auto comment: topic has been updated by sidchelseafan (previous revision, new revision, compare).