Unable to load image

AoC Day 14 : Sands of time

I won't paste my code yet since my parser just does the needful, and I somehow manage to get overlapping grains of sand, though that doesn't matter in the end.

I'm also seeing a lot of pythonistas having high runtime (1-10s+ and more) and I'm here with the bruteforce grain-by-grain taking 150ms for part 2 (including drawing the final graph lmao). Matlab chads can't stop winning :gigachad2:

EDIT : part 2 webm

16
Jump in the discussion.

No email address required.

Today's problem was fairly easy. I adopted a brute force approach since who cares, I am not gonna die for using ~2MiB of system memory, maybe it's slow but surely it works

real    0m0,103s
user    0m0,095s
sys     0m0,007s

![](/images/16710117614524431.webp)

Jump in the discussion.

No email address required.

Tbh there is a pretty easy way to optimize it. Instead of dropping it from the source, just save the full path and drop it from the last valid position, saves a lot of time.

If you just want to optimize part 2, just make a wave.

Jump in the discussion.

No email address required.

:#marseyreading:

Yeah you're right. Thankfully the inputs' dimensions are not too high

Jump in the discussion.

No email address required.

Yep. Fortunately in matlab I can easily add columns so I didn't need to hardcode a big playspace, but I've seen some people get fricked because they didn't hardcode it high enough :marseylaugh:

Jump in the discussion.

No email address required.

Matlabs chads simply cannot stop winning

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.