20 lines
661 B
Python
20 lines
661 B
Python
import aocd
|
|
|
|
import itertools
|
|
import functools
|
|
|
|
def parse(line):
|
|
return [int(c) for c in line]
|
|
|
|
def max_joules(bank):
|
|
return max(functools.reduce(lambda a, b: a*10 + b, joules) for joules in itertools.combinations(bank, 12))
|
|
|
|
def main(data):
|
|
banks = [parse(line) for line in data.strip().split()]
|
|
return sum(max_joules(bank) for bank in banks)
|
|
|
|
if __name__ == '__main__':
|
|
print("We let this run for 15 hours and it's still not done, need to figure out something better", file=__import__('sys').stderr, flush=True)
|
|
solution = main(aocd.get_data(day=3, year=2025))
|
|
print(solution)
|
|
#aocd.submit(solution, part='b', day=3, year=2025) |