adventofcode

Aleks 2024-12-18T05:27:41.304339Z

Day 18 - Solutions

Apple 2024-12-19T21:14:14.950529Z

Aleks 2024-12-18T05:27:52.095279Z

What a relief today! Anyway, I need to think on how to optimize part 2 https://github.com/zelark/AoC/blob/master/src/zelark/aoc_2024/day_18.clj

2024-12-18T06:00:17.762869Z

https://gitlab.com/maximoburrito/advent2024/-/blob/main/src/day18/main.clj You could definitely bsearch part2 to speed it up, but there's really no bother. I definitely got tripped up on the wording, expecting there to be some trick. Will the blocks fall from the top? Do corrupted blocks come in every step? Why is the example so simple? But no... It was just trivial search...

Aleks 2024-12-18T06:12:25.690449Z

Yeah, binary search would speed it up, but maybe there are some other techniques

Maravedis 2024-12-18T06:14:57.383249Z

Rarely seen a more straightforward a-star application. Binary search for part2, although the first time I did it, I just ran it linearly. Nothing much to say really. Both parts run under 100ms.

Aleks 2024-12-18T06:15:43.676249Z

> Will the blocks fall from the top? I thought about https://adventofcode.com/2022/day/14 at the moment

roklenarcic 2024-12-18T07:02:04.208659Z

hm didn’t think of binary search, runs in like 6 seconds in any case

rjray 2024-12-18T08:11:23.687239Z

https://github.com/rjray/advent-2024-clojure/blob/master/src/advent_of_code/day18.clj Simple BFS for part 1, and semi-brute-force of just adding the blocks in order and running the fn of part 1 until it fails to reach the end for part 2. I must be doing something wrong in how I actually run my code. It never runs as fast as the times other people report. I general run it through lein, specifically lein run .... Is there a step (like compiling) that I'm missing?

Aleks 2024-12-18T08:16:00.180969Z

Ok, I put binary-search in my core. Updated part 2, now it takes about 50 msecs. Btw, I just run it with time a few times, no compiling, and parsing included. https://github.com/zelark/AoC/blob/master/src/zelark/aoc_2024/day_18.clj

tildedave 2024-12-18T08:50:50.060999Z

it's EASY! I coded binary search out of pickiness (uh, instead of manually just plugging numbers into the repl) and it worked the first time. https://github.com/tildedave/advent-of-code/blob/main/src/advent2024/day18.clj

bhauman 2024-12-18T16:54:07.305089Z

Here’s today’s: https://github.com/bhauman/adv2024/blob/main/src/adv2024/day18/sol.clj Dijkstra’s and 2 minutes for part 2

bhauman 2024-12-18T16:57:11.384079Z

OK binary-search that makes sense. Funny that I implemented it yesterday …. [edit] the above is updated with binary search :)

tildedave 2024-12-18T16:58:04.689999Z

I kind of want to re-code it using some approach that keeps the path and re-calculates based on some intermediate structure as the bits fall.

bhauman 2024-12-18T17:00:23.557869Z

might help to do it in reverse in that case. Start with the all the bytes and take them away one at a time …

☝️ 1
Maravedis 2024-12-18T17:01:37.376839Z

Is it me or is 2024 markedly easier than past years?

bhauman 2024-12-18T17:02:32.262379Z

It seems easier, but I’m always afraid to invite the wrath of the AOC gods …

Maravedis 2024-12-18T17:05:50.129119Z

Yeah, I'm totally jinxing it.

tildedave 2024-12-18T17:06:43.622489Z

I guess day 9 has been the most annoying so far.

Aleks 2024-12-18T17:06:43.983279Z

I hope it won't go crazy in the coming days.

bhauman 2024-12-18T18:01:29.813679Z

🙏

genmeblog 2024-12-18T18:39:23.335429Z

BFS on both parts, second based on reverse (20ms). https://github.com/genmeblog/advent-of-code/blob/master/src/advent_of_code_2024/day18.clj

1
Felipe 2024-12-19T00:24:31.399709Z

I also did reverse for part 2

Felipe 2024-12-19T00:24:58.803759Z

Felipe 2024-12-19T00:25:48.871689Z

400ms though 🤔

tschady 2024-12-19T02:21:27.269139Z

used ubergraph https://github.com/tschady/advent-of-code/blob/main/src/aoc/2024/d18.clj

2024-12-18T17:10:43.654899Z

running behind, but we are live!