Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

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

Автор adshin21, история, 5 лет назад, По-английски

Problem Link

My solution in Python3... Link 1

My Solution in PYPY3... Link 2

Any suggestion will be also great.

Thank You !

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

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

Each interpreter has different performances depending on the use case: https://pybenchmarks.org/u64q/python3.php

»
5 лет назад, # |
Rev. 2   Проголосовать: нравится +8 Проголосовать: не нравится

Python and PyPy are not the same thing. PyPy is usually quicker but that isn't always the case. BTW the reason why you are getting TLE is because you are using += on the strings. This is incredibly slow because strings cannot be modified in python (they are immutable), so it creates a new copy of the string every single time you do +=. Instead do this and you will pass without any problems.