Fork me on GitHub
#adventofcode
<
2019-12-14
>
misha10:12:24

@pastafari print it out, and you'll immediately know what's up

misha10:12:05

when in doubt – print it out! opieop

misha10:12:47

day 14 "Elapsed time: 2.936473 msecs" "Elapsed time: 84.136665 msecs"

fellshard21:12:20

Hmm. Got a solution, really want to figure out how to reliably solve it. Probably a binary / other more informed search method to seek the boundary. As it is, I refined it by hand until it was close enough to solve by just injecting fuel.

fellshard21:12:11

Got to it late due to family time - not sure how I want to visualize this one, either. I saw some neat diagrams in Reddit.

dmarjenburgh22:12:29

My submission for day 14. I was afraid part 2 would be very computationally slow, but it executes in ~ 30ms simple_smile https://gitlab.com/dmarjenburgh/adventofcode/blob/master/src/adventofcode/year_2019.clj#L397-443

fellshard23:12:52

That bisect functionality is exactly what I need to steal replicate.

misha08:12:57

I did split stash and spendings too, but then just allowed negatives in spendings. made it noticeably more readable

misha09:12:49

but something else runs 3 times slower opieop

fellshard18:12:22

Negative spending - you just make incremental passes to sweep through and request more stock for those entries?

misha19:12:57

not sure what you mean, but if you need to "buy" 7x but recipe is 10x for 10y, your cost map would be {:y +10 :x -3} where :x -3 is a surplus from transaction you will might use in future transactions

👍 4
misha19:12:54

at first I tried to track 2 maps: cost and surplus: {:y 10}, {:x 3}, but merging those after each transaction was a chore and slow

misha19:12:17

(< n amount) (assoc cost x (- n amount))