Cloverr_'s blog

By Cloverr_, history, 4 years ago, In English

I am trying to solve this 1234C - Трубы.

In the 5th test case, i am getting a max recursion limit exceeded error 88052124. I have tried setting the sys.setrecursionlimit and also tried solving it with C++ 88047895, and still getting the same issue. I tried generating a lot of random test cases locally to test it, however everytime it runs succesfully.

Can anyone suggest me what I am doing wrong or provide a example where my code will fail.

  • Vote: I like it
  • +15
  • Vote: I do not like it

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

In the C++ version, one trick is to pass large things, like strings, by reference. Passing by copy will copy the same string onto the stack for each recursion level, while passing by reference will not, saving a lot of memory.

88059841

Notice how the only difference is string& instead of string.