day 24 optimize
Speed up part 1 by doing a LOT less work: quantize the distances by 1
billion (
200000000000000 becomes 200000); this introduces up to 1%
error for the largest velocities, but still gets the right answer on
my input. Quantizing larger at 10 billion missed two intersections
(too much inaccuracy); quantizing smaller misses out on the benefits
of swapping some calculations to 32-bit math. Round-to-nearest may be
slightly better than truncating, but I couldn't be bothered.
Then shift the data to be centered about the origin instead of
300,300; range checking is simpler as |val|<100 than it is with
200<val<400. Now runs in ~18s.