#2023 Day 06

70 messages · Page 1 of 1 (latest)

near cloud
undone ravine
#

This seems easy?

smoky carbon
#

today's seems more like a mathematics puzzle than a coding one

smoky carbon
undone ravine
#

fair lmao

undone ravine
#

part 2 was also easy

#

arguably easier

icy moat
#

isnt its a bit easy for AoC?

smoky carbon
#

did this one in Excel, just because

undone ravine
smoky carbon
undone ravine
#

oh of course

#

||waits, whats squared here?||

#

||nvm I understand||

#

I havent been in school for 15 years cut me some slack OMEGAlul

icy moat
#

speed is unnecessary

smoky carbon
undone ravine
#

lmao

dry echo
#

part 2 is somehow flying over my head

#

You could hold the button anywhere from 14 to 71516 milliseconds and beat the record, a total of 71503 ways!
and asks
How many ways can you beat the record in this one much longer race?
what?

undone ravine
#

||Yeah so, instead of doing the multiplication thing from part 1, literally just say the number of ways||

#

||a "way" to win is just a number of ms you can hold it which will result in a record break||

south valley
#

First time I found part 2 easier than part 1 kek

undone ravine
#

Yeah haha

coarse imp
#

it is, if you don't dumbo p1 like i did

#

because then p2 is not happening apparently it is, just takes a few secs

south valley
dry echo
#

I suppose I dumbo'd part 1 as well then, because p2 results in the same as the number already mentioned in p2 PepeStraightFace

coarse imp
#

|| iterating possible races might not be the way to go ||

smoky carbon
#

undoubtedly slower than brute-force iteration for the size of numbers in part 1

#

but likely quicker for the part 2 calculation

coarse imp
#

|| oh... i also could've waited 3 more secs playdead ||
|| naive p1 does actually work for p2, it's not as terrible as it looked ||

ionic grove
#

AoC playing games, yesterday's was so hard and this one's so easy

agile sphinx
#

|| I‘m being proud of everyone not dumbo‘ing it ||

undone ravine
#

||Mine was half dumbo, I just iterated to find the first winning race, but recognised that the last winning race is that time subtracted from the max time||

#

||Commutative multiplication||

smoky carbon
#

what is that, MATLAB?

topaz walrus
#

ocaml

#

||x' = x - (- x * x + t * x - (d + 1)) / (- 2 * x + t)||

#

||repeat this and it converges very fast||

smoky carbon
#

how many iterations for part 2?

topaz walrus
#

10

#

||yes five for each root||

smoky carbon
#

I like the method though, very elegant

topaz walrus
agile sphinx
#

|| that’s how quadratic functions look like, they are symmetrical ||

smoky carbon
#

||yeah, if you think of the graph, it's always 0 at x=0 and x=time, and the maximum is always halfway between the two||

topaz walrus
#

i feel like you can get it to like ~2 iterations ||using the convexity of parabolas||

astral geode
#

todays was refreshing

astral geode
#

wow the perl devel profiler is really nice

ocean crater
ocean crater
#

Little faster once the jit warmed up (and I wrote a slightly optimized version)

coarse imp
#

with the naive approach

#

meant to say: no optimization necessary, even if you took the worst possible solution || iterating through every race and calculating if it is won or not ||

undone ravine
#

that would be shockingly bad to completely ignore ||commutative multiplication|| at least

coarse imp
#

nah, it actually works okay

#

i expected it to not, which is why i didn't even try it, but after having a better solution (shockingly close to yours, actually) i tried it again

undone ravine
#

I mean yeah iterating every race definitely would work, it's just a waste of time lol

coarse imp
#

i absolutely expected it to not work
that's what he does, usually
naive gets you to 1, but p2 is off limits

civic galleon
#

My solution for p2 was ||brute force and it took only 60ms without logging||