Блог пользователя tom

Автор tom, 10 лет назад, По-английски

Hello everyone,

I started learning Python few days ago and I encountered issue during solving problem from Div2. Look at these submissions:

10232811

10232825

They second one differs with one line: sys.setrecursionlimit(10000)

Without it first submission gets RTE on test #19.

Is it my fault, bug in CF or something else?

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

»
10 лет назад, # |
Rev. 2   Проголосовать: нравится +24 Проголосовать: не нравится

n*m = 50*50 = 2500. If you start at the top left and go recursively through all cells then your depth can reach 2500. Python by default has recursion depth limited to 1000 and it throws the max recursion depth exceeded once you try to go deeper. By setting the recursionlimit higher you allow him to go on.