To count number of quadruplets with sum = 0

Matimus mccredie at
Fri Mar 16 00:22:32 CET 2007

> Any ideas to speed it up say 10 times? Or the problem only for C-like
> langs?

I dout this will speed it up by a factor of 10, but in your solution
you are mapping the values in the input file to longs. The problem
statement states that the maximum value for any of the numbers is
2**28. I assume the reason for this is precisely to allow you to use
32-bit integers. So, you can safely use int instead, and it _might_
speed up a little.

More information about the Python-list mailing list