Please read the new rule regarding the restriction on the use of AI tools. ×

Samyak_cool's blog

By Samyak_cool, history, 7 months ago, In English

During the recent contest, I was solving F and faced run time error on Test — 6, where recursion stack limit exceeded the default 1000 limit set by python. I tried to increase it using sys.setrecursionlimit but it was of no use. Please tell how to increase recursion stack limit. Here is my submission — 246218059, Submission link

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

»
7 months ago, # |
  Vote: I like it 0 Vote: I do not like it

One can use sys.setrecursionlimit(n). I cheesed some problems in Uni this way.

Your code can be run through priority queue tho. In python it's way more efficient than increasing the recursion stack.

Your code is also hella sus, if you know what I mean. What's up with the comments?

  • »
    »
    7 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    checkCycle code is from a standard source I picked from internet. Also according to some other blogs in code forces, sys.setrecursionlimit(n) doesn’t work.

    Will check on implementing it through priority queue.

»
7 months ago, # |
  Vote: I like it +3 Vote: I do not like it

use c++

»
7 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I don't trust python for recursion.