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
One solution is declaring all the vectors and arrays as global. Then u dont need to pass them to your DFS functions.
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