This commit is contained in:
Adam Jeniski 2025-12-08 14:01:45 -10:00
parent da7b893c37
commit 4eae354f25

View File

@ -4,7 +4,7 @@
(def input (->> (input-manager/get-input 2025 8) (def input (->> (input-manager/get-input 2025 8)
(mapv (comp (partial mapv parse-long) (mapv (comp (partial mapv parse-long)
(partial re-seq #"\d+"))))) (partial re-seq #"\d+")))))
(def circuits (into #{} (map hash-set input))) (def initial-circuits (into #{} (map hash-set input)))
(defn square [x] (* x x)) (defn square [x] (* x x))
(defn dist-squared [[ax ay az] [bx by bz]] (defn dist-squared [[ax ay az] [bx by bz]]
@ -32,7 +32,7 @@
(disj circuit-a) (disj circuit-a)
(disj circuit-b) (disj circuit-b)
(conj combined)))))) (conj combined))))))
circuits) initial-circuits)
(sort-by count) (sort-by count)
(take-last 3) (take-last 3)
(map count) (map count)
@ -50,7 +50,7 @@
(if (= 1 (count circuits')) (if (= 1 (count circuits'))
(reduced [a b]) (reduced [a b])
circuits'))))) circuits')))))
circuits) initial-circuits)
(map first) (map first)
(apply *)) (apply *))