When submitting a solution in C++, please select either C++14 (GCC 6-32) or C++17 (GCC 7-32) as your compiler. ×

depressed_ontop's blog

By depressed_ontop, history, 3 years ago, In English

I am getting run-time error most of the time in python in problems involving trees. I have increased recursion limit then also I am getting run-time error .And same logic works in C++.

Some of my recent submissions 119637795,119420809 and there are many more .

I want help, Is there any way of doing DFS in python without getting run-time error.

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

I don't think there is any solution for this "problem". instead one should get comfortable in c++ programming.

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

    The solution is wrapped into a function. This function is run in a new thread. Before that, the stack limit for new threads is updated.

    The trick of starting a new thread to control the stack size in the contests is old. I first saw it used for Java some time around 2010. 119420809 Now it is accepted. I got the solution thanks to Gassa