Expand description
Β§Restroom Redoubt
For part one we jump straight to the final position by multiplying the velocity by 100. The image appears in part two when the positions of all robots are unique.
The x coordinates repeat every 101 seconds and the y coordinates repeat every 103 seconds. For part two, we can treat the coordinates independently, searching for a time when the variance of the robotsβ coordinates is at a minimum.
Using the Chinese Remainder Theorem we combine the two times into a single time mod 10,403 that is the answer.
ConstantsΒ§
FunctionsΒ§
- minimum_
variance π - Calculate the population variance for each time in the period, returning the time when at the minimum variance.
- parse
- part1
- part2