SUMTRIAN Getting TLE in Python ??

Same logic gets accepted in c++ with cin and cout but gets TLE in python 3

question link:text

link:for c++ code link


link:for py3

Please write ur comment in comments section at the end of the question…

There is no problem with your solution. Python is a lot slower compared to C/ C++ so Python questions are given a relaxed time limit (normally 2 or 3 times that of C). However the time is not sufficient for this question as Python 3 is a lot slower when using 2d arrays even with relaxed limits. Python 2.7 ,which is faster than python 3, however gets AC. I would suggest you port your code to version 2.7. Replacing the input() by raw_input() should be sufficient.

1 Like