Day 25 - Solutions
Ahh thanks that makes sense. Was thinking something fishy was going on there... π
This is my first year with participating in AOC on December and I totally get 32 β. I know this isn't much accomplishment for someone but I'm so proud of myself! For me, I used to work with Clojure but not anymore cuz I found a new job. I've missed it so much and I'm so happy now with Advent of Clojure! Thank you all here to get me inspired a lot everyday on slack thread.
this is the kind of problem that's really fun to code in a Lisp. nothing quite like read the file, map grid parse, filter it all, https://github.com/tildedave/advent-of-code/blob/main/src/advent2024/day25.clj thanks for all the tips and tricks in the thread this year, was great to participate and see how other people solved this stuff π
stuck on part 1 and not sure why. works well on example I have 250 locks and 250 keys in my data. Does it sound right?
I get an answer that's too high and not sure what to check anymore π
SHow your code and we might be able to give you a hint ?
indeed, I was going to share but just found the issue: i was using (zipmap [4 3 4 0 2] [1 2 0 5 3]) which works by accident on the example input.
I do this mistake regularly coming from scala where zip is a function to zip 2 collections in a new one
yeah, zipmap overwrites duplicate keys, need to (map vector xs ys) instead.
Thanks everyone! It was great to share AOC 24 with yβall. https://github.com/bhauman/adv2024/blob/main/src/adv2024/day25/sol.clj
(def input (->> (string/split-lines (slurp "src/adv2024/day25/input.txt"))
(partition-by string/blank?)
(filter #(< 1 (count %)))
(map #(->> (apply mapv vector %)
(map (comp dec count (partial filter #{\#})))
(vector (ffirst %))))
(group-by first)
vals))
(defn try-keys [[kys locks]]
(for [[_ k] kys
[_ l] locks
:when (every? #(<= % 5) (mapv + k l))]
1))
#_(->> (try-keys input) count)Nothing much to say, it's a day 25, those are always very short. Thanks to everyone participating, it really was awesome to feel like part of a group working together on something. I had a lot of fun.
It's pretty easy today ^_^ Thanks to everyone! You guys rock! https://github.com/zelark/AoC/blob/master/src/zelark/aoc_2024/day_25.clj
https://gitlab.com/maximoburrito/advent2024/-/blob/main/src/day25/main.clj Still have to finish off yesterday though...
A quick solution. Thanks for the great discussions here, I had a lot of fun and learned a lot too. https://github.com/erdos/advent-of-code/blob/master/2024/day25.clj
Merry Christmas https://gist.github.com/RokLenarcic/0a2300b06b7798f822892a94f95aff75
Thatβs clean erdos. Didnβt think to transpose. I was slow as crap today, because I kept trying to do clever things. The whole text about keys and locks threw me for a loop. I thought that keys and locks had to fit exactly, you know like REAL pin tumbler lock. Thatβs not the case here. So first thing I did was to merge the text maps and look if there were only \#, but that was a bust.
The text definitely was a lot of words to say nothing.
Worse it was misleading
day 25 done. Just need to get the other 13 stars :)
Keys donβt work like that. Otherwise a key that was just a thin rail would open all doors.
So yeah,
Well, to be fair, it doesn't say that a key that fit into a lock opens the lock. We're just pruning the keys set for each lock, to know which keys would physically fit so we can test it.
Ah true
But a real key fits into a lock even if the key is too high
again, otherwise it is trivial to guess the tumbler pins
itβs why pins are on springs
https://github.com/rjray/advent-2024-clojure/blob/master/src/advent_of_code/day25.clj Can't believe I made a mistake on this one that cost me nearly 10 minutes π. Considering how many days I wasn't able to start when the puzzles opened up (and the fact that I went almost two full days without looking at it at all), I'm pretty content with my final results.
You might need to sprinkle some suspension of disbelief in your puzzle reading, @roklenarcic π
Reading was the hardest part of this years AoC π https://github.com/jaspya/advent-of-code/blob/main/2024/clojure/src/day25.clj How are so many people not completing part 2 of today?
You need to have all the other days completed to finish 25part2. Many people did not finish 21 or 24.
Ta-da!
This year we had 1 hard day. Probably the easiest year so far.
I choose to believe we're just getting that much better π