Could Python be too slow for a problem?

So I have been using Python3.6 for the Recipe for Philosopher Stone problem (LAYERS Problem - CodeChef). I have been stuck on this problem for days and I keep submitting new and improved versions of my code but keep getting the “Time limit exceeded” error message. I’ve gotten to the point where I fail to see other ways to optimize. Looking at the other submissions in Python I can see that no one else has managed to beat this specific problem either (lots of the submissions have also failed because of the time constraint). So here lies my question. Could it be that other programming languages like C++ and Java outperform Python by such a huge margin that this problem is near impossible to solve with Python?

Yes, easily :slight_smile:

2 Likes

Thank you for your response. I will try to rewrite this program in Java then. But just out of curiosity do you have any tips on where Python should be avoided? From your link, I can see that Python performs adequately in some scenarios, but is really sluggish in other cases.

1 Like

No, sorry - I avoid it entirely for CP :slight_smile:

2 Likes