ARYANK3024's blog

By ARYANK3024, history, 4 years ago, In English

I am getting MLE for this code https://codeforces.me/contest/1774/submission/186717963 Please Anyone Can help?

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
4 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hey man, i solved ur memory problem with the following submission: https://codeforces.me/contest/1774/submission/186734301

However, I got a time limit exceeded on the next test (22). Do u think u could give me a time complexity analysis for ur code to see what is the problem?

»
4 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Now i gets accepted by passing the visited vector by reference... !!

Thanks @TheOpChicken123 for pointing out.

»
4 years ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

Pass the reference for visted and curr vectors and make the necessary changes in update() and DFS() functions.

This is ACCEPTED submission of your code.

1st Change
2nd Change

Hope you got it right :)