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
EDIT : part 2 webm
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
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.
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: :marseylaugh:](/e/marseylaugh.webp)
Jump in the discussion.
No email address required.
Matlabs chads simply cannot stop winning
Jump in the discussion.
No email address required.
More options
Context
More options
Context
More options
Context
More options
Context
More options
Context