incomplete day 3
This commit is contained in:
parent
5199074512
commit
f1b3953873
|
|
@ -0,0 +1,18 @@
|
|||
import aocd
|
||||
|
||||
import itertools
|
||||
|
||||
def parse(line):
|
||||
return [int(c) for c in line]
|
||||
|
||||
def max_joules(bank):
|
||||
return max(a*10 + b for a,b in itertools.combinations(bank, 2))
|
||||
|
||||
def main(data):
|
||||
banks = [parse(line) for line in data.strip().split()]
|
||||
return sum(max_joules(bank) for bank in banks)
|
||||
|
||||
if __name__ == '__main__':
|
||||
solution = main(aocd.get_data(day=3, year=2025))
|
||||
print(solution)
|
||||
aocd.submit(solution, part='a', day=3, year=2025)
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
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)
|
||||
Loading…
Reference in New Issue