16 lines
412 B
Python
Executable File
16 lines
412 B
Python
Executable File
#!/usr/bin/env python3.11
|
|
|
|
from common import *
|
|
|
|
|
|
def part2(universe: Universe, factor: int) -> int:
|
|
pairs = pairs_of_stars(universe)
|
|
logging.debug(f"pairs={pairs}")
|
|
distances = list(map(lambda gs: gs[0].distance(gs[1], universe, factor), pairs))
|
|
logging.debug(f"distances={distances}")
|
|
return sum(distances)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print(part2(parse("input.txt", part=2), 1000000))
|