TLE or NZEC in Python - Turbo Sort

I just started learning Python and can’t for the life of me figure out why my solution isn’t accepted. Could anyone tell me what’s happening?

from sys import stdin
import psyco
psyco.full()
def main():
  tests = int(stdin.readline())
  frequencies = [0]*(10**6 + 1)
  for i in range(tests):
    num = int(stdin.readline())
    frequencies[num] += 1
 
  for i in range (len(frequencies)):
    if frequencies[i] > 0:
      print i
main()

Before I imported psyco and psyco.full() as CodeChef’s FAQs recommend for speeding up Python submissions, I would just get TLE. Now it’s constantly NZEC and I look at other solutions; mine doesn’t seem much different.

Note: I’m running my test cases on Python 2.7.6 IDLE

Psyco maintenance has stopped, and it doesn’t support Python versions after 2.5. Therefore, importing psyco with Python 2.7.6. will always get you a NZEC.

1 Like

Ah thank you, so there’s little point in CodeChef Python submissions since many will be automatically TLE without Psyco?

Actually, if you import sys, and use either sys.stdin.readline() or sys.stdin for very large input (see the the enormous input problem for more examples), you’ll be fine (I only got TLE when my algorithm was poorly designed).