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

Автор Problems_AB, история, 3 года назад, По-английски

Hi All, I'm getting memory limit exceeded on test 2, when I'm submitting the code. I'm not able to find out the reason. I would be really grateful to you all if someone could help me and tell me why I'm getting memory limit exceeded. TIA Here is my submission: 101191361

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

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

One solution is declaring all the vectors and arrays as global. Then u dont need to pass them to your DFS functions.

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

Hi All, I got accepted when I changed one line in my code. In the dfs function where I'm finding the cycle, if I write par[a]=p below the if(color[a]==1) condition instead of above it then everything works fine. Can someone tell me why it was wrong before and why was this one line causing MLE. TIA