Compare commits
2 Commits
f70ba6d543
...
9e57a7dffb
| Author | SHA1 | Date | |
|---|---|---|---|
| 9e57a7dffb | |||
| 4e5cba07bf |
@ -5,7 +5,6 @@
|
|||||||
(mapv (comp (partial mapv parse-long)
|
(mapv (comp (partial mapv parse-long)
|
||||||
(partial re-seq #"\d+")))))
|
(partial re-seq #"\d+")))))
|
||||||
(def initial-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]]
|
||||||
(+ (square (- ax bx))
|
(+ (square (- ax bx))
|
||||||
@ -27,10 +26,7 @@
|
|||||||
(if (= circuit-a circuit-b)
|
(if (= circuit-a circuit-b)
|
||||||
circuits
|
circuits
|
||||||
(let [combined (clojure.set/union circuit-a circuit-b)]
|
(let [combined (clojure.set/union circuit-a circuit-b)]
|
||||||
(-> circuits
|
(-> circuits (disj circuit-a) (disj circuit-b) (conj combined))))))
|
||||||
(disj circuit-a)
|
|
||||||
(disj circuit-b)
|
|
||||||
(conj combined))))))
|
|
||||||
initial-circuits)
|
initial-circuits)
|
||||||
(sort-by count)
|
(sort-by count)
|
||||||
(take-last 3)
|
(take-last 3)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user