infinitix's blog

By infinitix, 5 weeks ago, In English

In problem B of today's round (987), same solution submitted with PyPy 3.6 TLEd while it worked in PyPy3.10 and Python 3.8. What could be the possible reason?

PyPy 3.6 : https://mirror.codeforces.com/contest/2031/submission/291663544
PyPy 3.10 : https://mirror.codeforces.com/contest/2031/submission/291664045
Python 3.8 : https://mirror.codeforces.com/contest/2031/submission/291664084

  • Vote: I like it
  • +4
  • Vote: I do not like it

»
5 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

Your solutions are on verge of TLE with newer versions also, so version diff is enough to make it tle I think

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    I am still wondering why is this the case, since the solution is clearly O(n).

»
5 weeks ago, # |
Rev. 5   Vote: I like it +6 Vote: I do not like it

input() is really slow. Speeding up I/O makes your code pass with flying colors (even in PyPy 3.6)

using sys: https://mirror.codeforces.com/contest/2031/submission/291668369

using io.BytesIO: https://mirror.codeforces.com/contest/2031/submission/291667920