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

Автор A_Bored_Dog, 6 месяцев назад, По-английски

Hello Codeforces community,

I've been focusing on solving problems related to trees and depth-first search (DFS) recently. However, I've encountered a recurring issue when submitting my solutions. Specifically, my Python solutions often result in runtime errors on certain test cases, while the equivalent C++ code works perfectly.

For instance, consider the following submissions:

Problem 1: C++ code Python code

Problem 2: C++ code Python code

In both cases, the Python code shows runtime errors on random test cases (such as 3 or 9), while the C++ code does not.

Has anyone else experienced similar issues? If so, what strategies or modifications did you employ to resolve them? Any insights or suggestions would be greatly appreciated.

Thanks in advance for your help!

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

»
6 месяцев назад, # |
Rev. 4   Проголосовать: нравится +1 Проголосовать: не нравится

Default maximum recursion depth in python is ~1000. You can use this (some help in the blog below) to fix it, but the best way would be just avoiding recursion

https://mirror.codeforces.com/blog/entry/80158