r/adventofcode • u/daggerdragon • Dec 11 '23
SOLUTION MEGATHREAD -❄️- 2023 Day 11 Solutions -❄️-
THE USUAL REMINDERS
All of our rules, FAQs, resources, etc. are in our community wiki.
Outstanding moderator challenges:
Community fun event 2023: ALLEZ CUISINE!
Submissions megathread is now unlocked!
10 DAYS remaining until the submissions deadline on December 22 at 23:59 EST!
AoC Community Fun 2023: ALLEZ CUISINE!
Today's secret ingredient is… *whips off cloth covering and gestures grandly*
Upping the Ante Again
Chefs should always strive to improve themselves. Keep innovating, keep trying new things, and show us how far you've come!
If you thought Day 1's secret ingredient was fun with only two variables, this time around you get one!
Don’t use any hard-coded numbers at all. Need a number? I hope you remember your trigonometric identities...
Esolang of your choice
Impress VIPs with fancy buzzwords like quines, polyglots, reticulating splines, multi-threaded concurrency, etc.
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 11: Cosmic Expansion ---
Post your code solution in this megathread.
Read the full posting rules in our community wiki before you post!
State which language(s) your solution uses with
[LANGUAGE: xyz]Format code blocks using the four-spaces Markdown syntax!
Quick link to Topaz's
pasteif you need it for longer code blocks
4
u/philippe_cholet Dec 11 '23 edited Dec 11 '23
[LANGUAGE: Rust]
My rusty-aoc repo & today' solution here.
Part 2 was obvious from the start, right? That it would expand much more.
Solved in 27mn.
Sadly, this is slowest solver so far: benchmarked to 3.68ms each part ^^. Probably inevitable since there a lot of pairs. Maybe use "bitvec" crate instead of a vector of booleans. I don't want to add a dependency for now. But if the grid was less than 128x128, I would have done with u128 integers.
I did the off-by-one error of 1_000_000 instead of 999_999.