Codeforces и Polygon могут быть недоступны в период с 23 мая, 7:00 (МСК) по 23 мая, 11:00 (МСК) в связи с проведением технических работ. ×

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

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

Hi , I'm Getting TLE error on some python solutions so i used accepted python solutions also still tle error what is wrong with my code

Accepted Python Solution but now i'm getting TLE : SOlution Link

Exact copy paste solution still TLE : MY Solution

EDIT : I do not know what's happening this solution also gives TLE But Algorithm Time Complexity is O(n) it should work fine can anyone help me.

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

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

Maybe the version of python changed since and the input became slower. Personnaly to make input faster I do that: import sys to_read = sys.__stdin__.read().split("\n")[::-1] for k in range(int(to_read.pop())): n=int(to_read.pop()) a=list(map(int,to_read.pop().split())) b=list(map(int,to_read.pop().split())) similarly I use a join to print everything with only one call