Блог пользователя Homeo

Автор Homeo, история, 2 года назад, По-английски

I'm troubling with the idea that sometimes Python3 is faster than PyPy and i couldn't find why..

Its is actually frustrating in contests when i submit the same code with PyPy and it doesn't get accepted but with Python3 it gets accepted and i get penalty Deducted.

like this code here : The submission with Python3:

163955071 --> 716ms

The submission with PyPy:

163955090 --> 2152ms

I searched along the codeforces blogs to find a clear answer and i didn't find any.

  • Проголосовать: нравится
  • +10
  • Проголосовать: не нравится

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

https://mirror.codeforces.com/blog/entry/62431

pypy performs well with a large number of arithmetic operations

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Input and output is generally slow in python. You can use the pyrival template to improve your code execution speed. You can read this blog to improve python performance

Here is 372ms submission of your code using pyrival pypy3 template.