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

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

Hi, I am timing out on this problem, and I do not know why. https://codeforces.me/problemset/problem/1638/B https://codeforces.me/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.

EDIT: I already got the answer thanks everyone.

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

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

Use fast io. (2nd line of the submission)