help with TLE using python

Правка en1, от jcai972, 2022-03-02 18:56:13

Hi, I am timing out on this problem, and I do not know why. https://mirror.codeforces.com/problemset/problem/1638/B https://mirror.codeforces.com/contest/1638/submission/148130514 heres my submission to the problem. This should have a time complexity of O(n), but it times out on test case 5. I created 2 arrays, one for the even numbers and one for the odd numbers, and I checked if they were sorted. Is there any faster way to solve this problem, or am I doing something wrong? I'm submitting to PyPy 3 and I googled how to speed up I/O in python, but it still fails. Thanks in advance.

Теги tle, python3

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский jcai972 2022-03-02 19:12:19 53 Tiny change: 'n advance.' -> 'n advance.\n\nEDIT:\nI already got the answer thanks everyone. '
en1 Английский jcai972 2022-03-02 18:56:13 606 Initial revision (published)