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

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

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

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

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

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 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

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

Thanks @TheOpChicken123 for pointing out.

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

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 :)