Why difference in C++ and Python programs?

Правка en1, от IngaleAnkur10, 2019-03-13 16:45:31

I tried this problem: https://codeforces.net/contest/1136/problem/D.
And came up with a solution similar to the solution in the editorial.
But I first submitted my Python code in both Python3 and PyPy3 and had TLE.
But when I submitted an ALMOST equivalent code in C++, it got accepted.
I wonder what's wrong in my python code or is it the compiler's/interpreter's doing?

Python Code : https://codeforces.net/contest/1136/submission/51256343.
C++ code: https://codeforces.net/contest/1136/submission/51257855

Теги #c++, #python 3, #pypy3, #tle

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский IngaleAnkur10 2019-03-13 16:49:22 105 Tiny change: 'n/51257855' -> 'n/51257855. \n \nThanks in advance.' (published)
en1 Английский IngaleAnkur10 2019-03-13 16:45:31 572 Initial revision (saved to drafts)