Ayushman_123's blog

By Ayushman_123, history, 3 years ago, In English

Please tell me why I got runtime error while solving a problem with DFS even I set recursion limit also but I don't know why I got runtime error. Check my solution please. https://codeforces.net/contest/843/submission/131610110 https://codeforces.net/problemset/submission/884/131576407 Thanks

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

| Write comment?
»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

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

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

You're using setrecursionlimit to increase the height of the stack but what you need is to increase the overall size of the stack, which can be easily be done using the threading module. Your modified submission in python for one of your problem. Hope this helps you.

  • »
    »
    3 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    it's really very helpful but don't you think 10**8 tends to memory limit exceeded sometimes ? Thank you so much for that modified code.

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      True, that's why you should consider using python3 until codeforces starts supporting 64-bit version of pypy3