1 / 3
Jan 2015

My pypy submission for tetrasum took 4.20s. frowning but i have seen some submissions which are way more less than that in python 2.7.
i'm using matrix exponentiation. is it my algorithm or my implementation. I have tried to use numpy, which gave me TLE. confused so can any
one please help me with a hint..

  • created

    Jan '15
  • last reply

    Jan '15
  • 2

    replies

  • 400

    views

  • 2

    users

There's few Python AC ; it's true.

You need general tricks for speed this one. It's not TETRA related.
You should try speed experiments with SEQ too,
you should let matrix (it is very slow) and rather work with polynomials ; if you know how,
you should use exponentiation by block (k-ary method), if you know how.

But I think you already know some of the tricks as you got yet AC.
There's still a lot.
If you try my 'recursive sequence problems' and got max speed, then at last you will have a great bag of tricks.
It's quite a long work to master them all.
In my MOTO page, there's other problems with similar techniques like SNAKYNUM, NUMPLAY, FLIB, ... (each with some few different ideas to get full speed)

Good luck.