majay1638's blog

By majay1638, history, 6 years ago, In English

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.

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

| Write comment?
»
6 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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