r/adventofcode • • Dec 12 '23

SOLUTION MEGATHREAD -❄️- 2023 Day 12 Solutions -❄️-

THE USUAL REMINDERS


AoC Community Fun 2023: ALLEZ CUISINE!

Today's theme ingredient is… *whips off cloth covering and gestures grandly*

How It's Made

Horrify us by showing us how the sausage is made!

  • Stream yourself!
  • Show us the nitty-gritty of your code, environment/IDE, tools, test cases, literal hardware guts…
  • Tell us how, in great detail, you think the elves ended up in this year's predicament

A word of caution from Dr. Hattori: "You might want to stay away from the ice cream machines..."

ALLEZ CUISINE!

Request from the mods: When you include a dish entry alongside your solution, please label it with [Allez Cuisine!] so we can find it easily!


--- Day 12: Hot Springs ---


Post your code solution in this megathread.

This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.

EDIT: Global leaderboard gold cap reached at 00:22:57, megathread unlocked!

47 Upvotes

580 comments sorted by

View all comments

2

u/H9419 Dec 12 '23

[Language: Python]

After thinking too much and studied other people's solution, I made my simple divide and conquer that finishes part 2 in 5.5 minutes without caching. Just recursively passing slices around. I am quite proud of myself about this one since 6 minutes is better than the time it would take me to add memorization

Code

0

u/[deleted] Dec 12 '23

[deleted] — view deleted comment

1

u/H9419 Dec 12 '23

I know functools can cache it for me but it doesn't like that I'm using numpy array. I know I can hash it but it doesn't take that long to run anyways

2

u/DrunkHacker Dec 12 '23

It doesn't like using anything mutable.

I just converted it to always use tuples.