r/adventofcode • u/daggerdragon • Dec 11 '22
SOLUTION MEGATHREAD -π- 2022 Day 11 Solutions -π-
WIKI NEWS
The FAQ section of the wiki on Code Formatting has been tweaked slightly. It now has three articles:
Code blocks (the four-spaces Markdown syntax that everyone should be using)
Fenced code blocks (aka triple-backticks; please do not use this syntax!)
Inlined code (intended for
short snippetsof code)
THE USUAL REMINDERS
A request from Eric: A note on responding to [Help] threads
All of our rules, FAQs, resources, etc. are in our community wiki.
Signal boost: Reminder 1: unofficial AoC Survey 2022 (closes Dec 22nd)
πΏπ MisTILtoe Elf-ucation π§βπ« is OPEN for submissions!
UPDATES
[Update @ 00:13:07]: SILVER CAP, GOLD 40
Welcome to the jungle, we have puzzles and games! :D
--- Day 11: Monkey in the Middle ---
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?
3
u/Colin-McMillen Dec 11 '22 edited Dec 11 '22
C on the Apple //c for part 1, C on the laptop for part 2
No particular problem for part 1, it was even fast.
Then I implemented a very very stupidly slow bigint. It does work, mind you... with part 1.
It does not even go past round 7 or 8 on the 3GHz laptop before I understood that was stupid.
I finally had THE lowest common denominator idea, which quickly gave me the answer on the PC.
It's still searching for the LCM on the Apple //c at that time but I already know the final multiplication will overflow. I'll be happy if the inspections counts are good (EDIT: They're not. old*old overflows uint32 quite fast.) :)
Still happy, I implemented strsplit(), trim() and bubble_array_sort() in the process and I'll have use of those !