r/adventofcode • u/daggerdragon • Dec 15 '22
SOLUTION MEGATHREAD -π- 2022 Day 15 Solutions -π-
THE USUAL REMINDERS
- All of our rules, FAQs, resources, etc. are in our community wiki.
- A request from Eric: A note on responding to [Help] threads
- Signal boost: Reminder 2: unofficial AoC Survey 2022 (closes Dec 22nd)
- πΏπ MisTILtoe Elf-ucation π§βπ« is OPEN for submissions!
--- Day 15: Beacon Exclusion Zone ---
Post your code solution in this megathread.
- Read the full posting rules in our community wiki before you post!
- Include what language(s) your solution uses
- Format code blocks using the four-spaces Markdown syntax!
- Quick link to Topaz's
pasteif you need it for longer code blocks. What is Topaz'spastetool?
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:27:14, megathread unlocked!
48
Upvotes
View all comments
1
u/udoprog Dec 15 '22 edited Dec 16 '22
Rust
Well, after too many false leads here it is. Still suspiciously free from allocations. I said that yesterday was the slowest one that I've implemented so far but I take it back. Today is the day:
Still pretty happy with the timings, I'll be considering potential optimizations over the day so we'll see what's what (Maybe each row +/- 2 can help when calculating distances). I'm happy with how the implementation turned out though.
Repo Link.
EDIT: To briefly describe the implementation: For each line, construct a sorted set of spans which are covered by beacons, these are iterated over to find a gap which is our
x.