Hi, I am getting TLE in http://www.spoj.pl/problems/ABCDEF/ using Python. I have try a lot of possibilities but none of them has been successful.
Removed after AC.
Lesson: On my PC, the program using defaultdict ran faster than the one using normal dict. On SPOJ, it was the opposite.
defaultdict module has gave me the best results. My program runs the test case 100 1 2 3 ... 100 in about 0.25s in my computer, but it gives TLE in SPOJ.
Besides, if I use
for (a, c) in product(w, w):
for a in w:
for c in w:
I got Runtime Error (NZEC), and I do not know why.
Can someone help me?