Hey everyone,
I was solving the problem Mortal Kombat Tower (1418C)(https://codeforces.me/contest/1418/problem/C) and wrote my solution in Python first. However, when I submitted it, I got a Runtime Error on Test Case 3.
Feeling stuck, I randomly decided to convert the same logic into C++ and submitted it... And guess what? It got accepted!
Now, I'm really confused! How did the same logic work in C++ but fail in Python?
Here are my submissions: Python Code (Runtime Error ): 305031310
C++ Code (Accepted ): 305032334
What could be the reason? I have a few possible guesses: 1. Integer Overflow or Recursion Limit in Python 2. Differences in Default Recursion Depth (C++ vs Python) 3. Memory Usage Differences 4. Unintentional Indexing Issues in Python
But I'm still not sure! If anyone can analyze my submissions and explain what went wrong, I’d really appreciate it.
Thanks in advance!
I took your submission and added a exception printer. link. It prints RecursionError('maximum_recursion_depth_exceeded') on test 3.