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
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?
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.
use c++
I don't trust python for recursion.