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

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

Автор Sukeesh, 8 лет назад, По-английски

Hello everyone,
I have been trying this problem
My Solution is getting Memory Limit Exceeded (even though I don't think, I have declared anything Memory consuming)
Can someone please help me?

EDIT : figured out my mistake! AC

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

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

Your DFS is incorrect, it will not work on graphs with cycles. For some reason ML happens way earlier than TL should happen, most likely because each call of DFS allocates another 4x(long long) memory.

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

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