Same logic, one AC other TLE

Code written in C++, got AC. But written with same logic in Python, got TLE.
Question link: DORAEMON
C++ submission
Python submission
I know Python is slower than C++, but this is not suppose to happen, I guess???

There’s really no fair way to prevent it :frowning:

1 Like