On Oct 7, 4:35 pm, Irmen de Jong <irmen.nos...@xs4all.nl> wrote: > I just got my solution accepted, it ran in 14 seconds though.
Hey, that's pretty good. Until n00m instigated the most recent INOUTEST craze, the only accepted answer besides numerix's was one that barely squeaked in at 19.81s, and that result was achieved with the older and apparently much faster (at least on the SPOJ machine) Python 2.5. (I see a lot of people trying to pass INOUTEST with Python these days, many or most of them because they have read this thread.) > Things that eventually made my solution run within the time limit: > - I didn't use int() > - I used Psyco > > Those two resulted in the biggest speed increase. > Tweaking with buffered/unbuffered IO was insignificant. Thank you so much for these tips. I quickly threw something together and now have my very own accepted INOUTEST answer! It's clearly not optimized, and I think a lot of people will soon have solutions much faster than mine and closer to yours, now that they are not wasting their efforts chasing dead ends. John P.S. I hope people realize that the concise, intuitive, readable answers we all tried in our first couple of (failed) attempts are much more Pythonic than the beasts that were created just for SPOJ. -- http://mail.python.org/mailman/listinfo/python-list