#advent-of-code
1 messages Β· Page 21 of 1
Good morning all,
I'm reading the puzzle and I think I understand what I have to do.
My biggest hurdle in handling the input is to get it worked into some form that I can use the workflow rules nicely, but I'll get that worked out somehow.
What I can't seem to get my head around though, is for the example input, how lines 1 and 3 are evaluated.
After reading the description a couple of times, I'm totally under the impression that every part goes through the workflows in order, I don't quite get WHY or HOW parts 1 and 3 seem to start at workflow 'qqz', instead of 'px' like the rest.
I wouldn't dare to say that there's an error in the puzzle itself, so clearly I'm missing something, but I can't figure out what it is.
Who can help me on that?
#aoc-solution-hints is a great place to ask in more depth. Asking here can get messy because of the need to avoid spoilers. If you're comfortable with more spoilers we also have a solutions thread that might have more guidance, at the risk of giving away more
I set an alarm clock for aoc. I'm sure it costs me a few spots to turn it off each day.
aoc is too early. I will not stand up at 6 am
I always have a bit of problems with wrangling my input with splits and strip. are there better ways to do this?
omg a language that I actually know for once
C#
yuck
wonder what day will uiua get
<--- doesn't know the mods don't know uiua
cool array lang
you know you can just click the overview for spoiler threads and you can directly see the language?
day 19 may have been my favorite so far
Yeah I liked today's puzzle
the fact that it worked my first try probably biased me π
programming more fun when you don't spend an hour painfully debugging
i haven't done today yet
Me on day 13 with my off-by-one
seems fun tho
i still have one I didn't manage to debug
the one with the broken gears parts or whatever
.#?
Hot springs
How did you get an off-by-one for hot springs lol surely you either get it right or massively wrong
When implementing the faster approach for part 2, I made some subtle error that only was incorrect for very large examples
idk
it wasn't off by one, to clarify
Ah
I didn't mean "an off by one I didn't manage to debug"
That makes more sense then
well, the underlying error is very likely an off-by-one
that doesn't mean the result is off-by-one
What was your general approach?
||DP||
So far, I didn't have time to fix that, and I also haven't had time to actually do 18; I looked up the formulas everyone's been using because I couldn't stand doing it the same way as day 10 again
And I also want to go back and optimize some days; I have 4 days that are over 1ms
but honestly not sure if any of that will happen
yeah off by one error
||i think i somehow did only 9 steps instead of 10 or something||
I'm terrified for the next 6 days
How many do you think will be very hard puzzles (gold lb cap >= 1 hour)
well, we've reached day 19 and it wasn't beacon scanner π₯΄
I make the bold guess that the ||Chinese Remainder Theorem|| will be relevant tomorrow.
yeah the difficulty seems fairly static this year
well that's why we have sympy
in 8 hours, i wake up at day20. it's called "bacon scanner". I go back to sleep.
I hate the beacon ones
I'd be happy with CRT
Or even something like modular inverses/slam shuffle
I still have zero confidence that the beacon scanner was solvable in the general case
Some other things that can come are reverse engineering or z3able ones
but whatever julia I scrounged up did work
Or a heuristic puzzle
Last year I only found 1 puzzle nasty (day 16, still don't get it) and 1 more that I couldn't do quickly (day 22, but it was a dumb problem)
oh interesting, I only got up to day 11 last year.
This year is going better than last year in terms of lb rankings but I'm getting more and more scared every day
I wonder what I was doing last year that I didn't manage to 50star AOC.
what is this channel about
advent of code? what does that even mean
the 3d rotation one?
For 22 I had to honestly copy my solution from online
It was worth it though as it got me like 60 points on 25
It's an event that runs every december where you get one programming puzzle a day
see #aoc-faq for more details
oo alr
Ye, the 12 overlapping beacons per scanner one
I gave up with that on 2021
The ones I didn't do that year were "Amphipods" and that one
My favourite was day 24
The one with reverse engineering
I just did that one with a constraint solver
there were some decently strong guarantees, right?
Yeah, I can't really come up with a counterexample, but intuitively, I don't think the assumptions I made would hold on a malicious case.
but frankly, imagining possibly rotated beacons in 3D is straining my mind as-is
I liked that problem
it really caught me off guard, took me a bit to see how to approach it in a good way
I didn't find the clever solution, so I just "bruteforced" it in julia and had the answer in a minute.
beacons?
... yeah that sounds complicated
I think I know how to start with this one though. lot of vectors for this one
I feel like that one was solvable in the general case
maybe not actually, idk
Actually, yeah. Basically, the idea was, scanners have at least 12 beacons in common. distances between beacons are invariant under translation and rotation of the beacons
so you could pretty rapidly start to establish connections between points
i'm not sure if it's possible to construct something sufficiently adversarial that would cause this to break down. Or even better than distance, a sorted list of 3 deltas.
You only need each beacon to have a single other beacon, which which it shairs a pair of points, that has a unique sorted list of 3 deltas
the distance thing is just an optimization since you can reject things quickly (cheap computation and rotation invariant)
you can ||try all rotations and compute differences between all points, the same vector should appear at least 12*11/2 times||
yeah, that's true, there aren't that many rotations anyway
I think that year was the last time I fully solved AoC
there are quite a lot
24
actually, no, that's a lie
a factor 24 more work can hurt
I just mean in the grand scheme of things, x24 will not make a feasible solution infeasible
sure
I mean there's a reason I used the optimization π
looks like 2020 is the last time I got all 50; I felt like that year was easier. 2021 and 2022 had some real doozies in the last 5 days
I think I needed it to do the whole year sub a second π
heh that's roughly my goal this year, first time i've really looked at perf much in aoc
I have 4 days over 1 ms atm
I suppose since I'm still under 1 second for everything, there's a decent chance I don't need to optimize any existing stuff... but still
yeah, most tasks are pretty trivial, then you get the actually computationally heavy stuff
2021
and 2022
very impressive
I probably won't actually make it; my algorithm chops tend to not be good enough, on average, to get all of the problems without a lot more work than I'm willing to put in (or more copying/getting help, I suppose)
hmm. i've only used c# for work, so now the thought of doing aoc in c# is kinda :(
Unrestricted C# can be a lot of fun. You can challenge yourself and solve the puzzle as a single LINQ query. π
I tried pretty hard to do that with kotlin (in a past year)
Kotlin has... a lot of stuff that lets you just keep chaining expressions forever
like it has all the typical iterator stuff but then on top of that it has Groupings and things that turn iterators into dicts/Maps or lazy versions thereof
and it has the scope functions which also let you keep chaining stuff
it does get a bit crazy though
huh. more ||range|| shenanigans today
indeed
Pretty close to day 20 now.
GLHF everyone
and by extension the end of aoc
GLHF
and by extension christmas
Pfft, it's clearly halloween
hmm
have you considered changing from octals to decimals
fair
anyway
my expectations suggest that i can't solve this day
past 19 days were alright
same, we're overdue for a hard puzzle
Language Roulette: Day 20
The language is ... C++
it's like those calamity predictions where a calamity happens every 100 years but it's been like 130 or something years
I can't believe you'd pick C++ over a good language like Rust smh
surely rust is in the pool, right? 
I can't imagine they'd put C++ in without also putting Rust in
Also Day 25 is clearly going to be Python
merging into normality
Anyway GLHF everyone
GLHF
<@&518565788744024082> Good morning! Day 20 is ready to be attempted. View it online now at https://adventofcode.com/2023/day/20. Good luck!
absolutely wrecked trying to part 1
I made the mistake of trying to be smart instead of brute-forcing lmao (EDIT: FOR P1 DUMMIES)
Cost me loads of time
i wish i could understand the problem as quickly as you guys solve it
||brute force works for p2?||
THERE'S A SMART WAY TO DO PART 2???
There's definitely a smart way of doing P2 and I probably shouldn't be trying to do it by hand but I'm not smart enough to write code for it
how
i'm bruteforcing rn
same lol
how long does it take
Same
No idea
Mine's been going for 7 minutes already
uh oh
Might RIIR to hope for speedup
mine just started
uh
what do i do
Join the language roulette and write it in C++
i don't think i even fully understand the state changes in the question today
i have no clue how to write in C++
neither rust
i'm officially damned
hmm, ||I think it's doing binary counting||
Yeah I think it probably is but I can't figure out a good way to speed that up with a program
||Tried doing it by hand but that will take ages||
||the hell is that||
is p2 the same with like a ||gazillion|| presses?
(no)
((that would have made my half-finished attempt actually useful))
i don't think i even understand p1 today
π advent of realizing i cant read is back
Same. I couldn't figure it out yet. I'm just here because I'm hoping for another fun problem
Havent Solved Since Day3 Part2 π¦ I Should Do Something
Well those are some bugs I should fix
Python brute-forcer has a 35 minute head-start, who would win
OH MY GOD I FORGOT THE RETURN IN THE PYTHON ONE
Even if it finishes it won't help
π€¦
π
If anyone is stuck try working through this simpler example by hand
broadcast -> a
%a -> b, e
%b -> c
%c -> d, e
%d -> e, e
&e -> a, b, output
i think this works??
||what's updog?||
aww, my joke doesn't work now
Lol
hi team ive done upto 9, but have had to hand in a final project for my sql bootcamp last week so ive fallen by the way side. Would someone be able to tell me which days are the easiest from day 9?
W
13 to 16 were pretty simple
my opinion:
10 - p1 is alright, p2 is a bit tricky
11 - pretty straightforward
12 - very hard (arguably the hardest so far)
13 - medium
14 - medium-hard
15 - reading comprehension, otherwise relatively easy
16 - medium-hard
17 - hard
18 - hard
19 - medium-hard
20 - more reading comprehension, p1 is ok but p2 is hard
you can also see the leaderboard fill times (https://adventofcode.com/2023/leaderboard/day/10) to get a sense of how hard a puzzle is
amazing thanks
10 i skipped
reading 11
hard agree, 12 part 2 was annoying
i don't think 19 is hard though
on second thought, maybe
I would say 16 is hard; it only becomes reasonable if you know a certain formula that most people didn't think of themselves
a lot of people (self included) grinded out 16 by doing things like tracing paths across and tracking boundary crossing
there's a formula for 16?
||shoelace + pick's||
16 was the ||mirror|| one, no?
oh my bad
maybe you're talking about 18?
i'm thinking of 10
for 10p2?
yes
even doing ||flood fill|| correctly is pretty obnoxious; there's no guarantee ||the interior is connected||
i did it by going row by row. meant ||18 didn't go as well||
So you have to somehow deal with that
the way I did it was ||floodfill from every point on one side of the loop||
right , but then the hard task becomes finding all those points
the way I did p1 made it pretty trivial
idk, it tends to be a pain I find
lru?
Getting to the point where you can slap on ||memoization|| is the hard part imo
Hm
For me it was quite natural
I found stuff like day 10 much harder
For me the two longest days so far are day 10 and day 17
The rest are much shorter
I guess it depends on how familiar you are with concepts like ||dp||
The instructions are getting too long π
My smooth brain cant focus long enough to go through them
wow C++ is annoying
lmfao, I feel like roulette has just resulted in you and fenix really liking some functional languages and being unimpressed with the rest
i've only ever used C++ for cp but this is harder than any problem i've done in c++ lol
but yeah. the functional langs in the beginning were pretty fun
certainly a lot more fun than vb or like
fortran π
still haven't finished that day btw
i feel you. i only use it in case i want to contribute to open-source softwares that requires it. otherwise, i only go by interpretative languages
Language Roulette: Day 21
The language is ... Java
GLHF
GLHF
Sadists
is the pool of languages in the roulette viewable somewhere? i'm curious what's in there
I saw it on the notion somewhere
It makes using fun programming languages all the better
So why is Java in the pool then
lol
<@&518565788744024082> Good morning! Day 21 is ready to be attempted. View it online now at https://adventofcode.com/2023/day/21. Good luck!
oh
Gotta be reminded of the unfun
day 24 aoc should be holyc
Agreed
Umh
how to p2
||the borders might make it easier to calculate how far you can travel||
i think i figured oti out
i can't believe you guys finished part 1 so quickly. I thought it'd be easy, but it seems to have a trick to it or something
things get real slow for me after just 12 steps. hell before that even
make sure that you ||don't count cells twice, and get rid of the cells reachable at previous step.||
hmm, yea good point
it's pretty much ||bfs where you replace your population of cells (a set) with a new one each step||
for part2 though, ugh.
i'm currently thinking of ||memoizing what cells are reachable from this cell in 100 steps||, so that I can ||reduce the number of steps required by a factor of 100||. not sure it'll be enough, though.
how to part 2 π
alright well now my code finishes quickly, but gives me the wrong answer lol. still, progress i guess
def part_two(): return 0
oh dear, something's not right with this
(casual 2 petabytes of ram)
OH
Wow leaderboard ain't filled yet
WHAT HOW
Oh yeah that'll do it
π
help π
π© why
WhAT!!!
considering there's no spoiler chat, p2 must be insane, ig
π u bet
yup
nvm i didn't see.
is it like a ||million|| steps?
||twenty million|| with ||infinite garden plots||
ah, seems easy to do though, if you did p1 efficiently π
guess ima go bruteforce π π
there are ||16 million positions after just 5k steps||
there's ~n^2 positions within n steps, so you're looking at O(n^3) complexity if you keep track of them
can't be more than ||17161||
?
found a faster bruteforce that goes like 15k per sec
that's still like half an hour
RIIC++ i guess
how does one even start with this π₯²
idk wym, solution can't|| exceed that value, actually lesser (considering the amount of #s||
its an ||infinite repeating grid so yes it can||
well, read part2
by their nature all(?) of the cells inside the covered area ||oscillate between being on and off with period 2||. so you can probably reduce a bruteforce solution to only considering ||the outgoing part of the wave, which scales with O(n), and then do some memoization on that||. sounds far too annoying to me, though, so I might ||have breakfast|| instead.
i love how ||have breakfast|| is a spoiler
i was about to say that lmfao
gave me a good chuckle in between crying about the puzzle
I have an idea of a reasonable algorithm but there are so many edge cases
i have no reasonable ideas
Ah
real
i want yall to know that i initially tried to solve part one by taking matrix powers and numpy complained about initializing a 1.5gb array
@covert arrow what is the golf right now
today might be my first day i dont finish before work
which means ill have to finish it during work instead /s
Is there even a golf π
my input looks like a diamond
leaderboard still isnt filled
im hoping he does
hes called golfing enthusiast after all
thought hed be good at it (jk
npc
real
i have no idea where to even start π
Yeah it's really hard
I think an int code year problem is still classed as the hardest based on lb fill time
my part 1 code also just has zero scalability
its just ||str.replace|| which is just gonna die on any larger scale
ah yeah, 2019 d18p2 had a nearly 2 hour lb fill time
Well then 2019 day 22 would be harder
yeah no thats fair
But I didn't find it very hard (as I am mainly a mathematician)
I'm a car enthusiast. But I hate driving
Compared to something like this year's day 17 - that was an implementation hell for me
I've been wondering how much of the lb fill time is tied to more folks participating
hello
It probably pays a non-trivial part in it tbh. We have a lot of consistent leaderboarders now that probably didn't know about this 4 years ago
im gonna lose it
can someone help me with day 5 pt 2 pls
i hard coded it and i pressed run like 10 minutes ago and nothing has popped up so i think im cooked
Lb still ain't filled? Wow, just wow.
You can look at the day 5 thread
80 minutes, oof that was a long one today
It's filled now?
Yup, just got there
I need to try this after I sleep
C++ bruteforcer started
now that I think of it, it should be possible to ||essentially factorize the task into movements within a board and between boards||, by ||precalculating possible transition periods between boards||.
wait a minute i'm not thinking right with this am i
i should be calculating how far the thing should reach
.-.
aanyway
that's what i've been trying to do for the past hour π©
hoping one of my bruteforce approaches come back with good results
π¬
wuh oh
OH THAT'S THE C++ BRUTEFORCER
???
Oh my god ||there aren't any obstacles in the same row as your start square||
This makes it so much easier
i don't think my C++ bruteforce works
p2 how?
grr
why?
why isn't the example input like that π
||add or sub multiples of grid size||, ||track your solution in terms of grids while you have enough area||
so it seems like there are 15604 reachable squares out of 17161 in my input
what do i do with that info
oh, it's my cake day today
so ||horizontally the max reach is just Β±26501365 units from the original||?
how do i approach this-
...okay, got it. I'm not sure I enjoy how many aoc days I solved by ||spotting a pattern in data without understanding what causes it||
alright, im off to work - maybe later today
My solution has been running for 18 minutes and I don't see why it's so slow
It's stuck in the 'explore trivially-explorable grids' step
oh that's still like 41 billion things though lol
today's golf : ||#1180008645384216606 message||
I hate that day.
how difficult is yesterday and today?
uni offers just came out and I'm swamped with work, so I need a rough estimate of how much time I should dedicate
Yesterday part 1 is simple enough, part 2 requires a bit of maths.
Today part 1 is doable with graph computation.
Part 2 is just pure hell.
This is the first day I failed though.
yesterday wasn't very hard (hint: it's one of the "||probably near-impossible in the general case but all the inputs are such that it's pretty easy if you look at them||" days that are very common this year). today is... objectively harder given the leaderboard fill speed, but I solved it by ||finding a pattern in the answers||.
I still didn't understand most of people's solutions for Day 21/2.
For Day 18 (part 1), do we have to mind the subtleties of day 10 (cf. screenshot)
I believe so
I=inside
O=outside
so same as day 10 damn
wait is there prize for pydis top finisher(s)
i might be hallucinating but i remember a discord role or something
the Completionist role will return, yeah
I can't believe the 2015 AoC had you mine bitcoin for the authors π€¦
any suggestions for what i should do a year of aoc in casually
i've tried rust, go, and haskell (unsuccessfully)
anyone keep a note of what algorithms or data structures worked best over the years of each day?
idk about "best" - do you mean most commonly?
yeah I think the most common algos and data structures is what I was going for...
ocaml π₯°
i think all the bread and butter of CS, mostly
arrays, hash tables, sets, linear search, binary search, graph traversal, Djikstra's
yeah, this is where 'self-taught' and not seeing those in application at least for me hurts.
yeah, it's definitely much easier with a freshman DSA course under your belt
once we get into the pathfinding, searching etc. I start to lose it and need to start watching and reading what others are applying and I was trying to get an idea of what I should be reviewing.
i'd suggest just doing a few DSA classes on coursera
if what you want is to learn this stuff
yeah, I would like to expand my knowledge in those areas for sure. Then again, in my day to day I hardly ever encounter these types of problems or I am ignorant to the solution and shape of the problem that fit together. I will check out some of the DSA documentation.
just use the oop parts of ocaml :D
does it have for loops
i mean last time i tried haskell and i couldn't get past day 7 lol
granted it was 2019 but still
+1 for ocaml or f#
no but seriously having worked with imperative for so long
i think i'm too dumb for functional lmfao
both langs give you an "out" if you want to mutate stuff or iterate imperative style
|| ```py
def sum_distances(gxs, rows, cols):
total=0
for (ga_x, ga_y), (gb_x,gb_y) in gxs:
dist=0
if ga_x < gb_x:
dif = gb_x - ga_x
for i in range(ga_x+1, gb_x):
if i in cols:
dif+=1
dist+=dif
else:
dif = ga_x - gb_x
for i in range(gb_x+1, ga_x):
if i in cols:
dif+=1
dist+=dif
if ga_y < gb_y:
dif = gb_y - ga_y
for i in range(ga_y+1, gb_y):
if i in rows:
dif+=1
dist+=dif
else:
dif = ga_y - gb_y
for i in range(gb_y+1, ga_y):
if i in rows:
dif+=1
dist+=dif
total+=dist
return total
i dont get what's wrong in my logic
i am getting in day11 part1 less than i should
I ||count empty cols x2 and same with rows||
if you want help, use #aoc-solution-hints where you could even open a new thread just for yourself and when you do, post the whole code so people can run it on the test input
idk how i feel about day 20
oh, okay sorry
π
definitely a go to bed moment
have some ideas but i'm gonna need some sleep to solve this
gn
i was confusing x with y's
that's why i always use rows and columns to represent my points instead
I always use grid[y][x]
its even more confusing when game libraries invert y...
ues dictionaries then. π
gardens = { (x,y): cell for y,row in enumerate(aocdata) for x,cell in enumerate(row) }
by hit you mean "operate faster" then sure. π
also boundary checks are a lot easier.
especially useful for any sort of problem where you want to exclude content or find a specific point.
gardens = { (i,j): cell for j,row in enumerate(aocdata) for i,cell in enumerate(row) if cell !='#'}
start = next((i,j) for i,j in gardens if gardens[i,j] == 'S')
start over from what you remember, or grab someone else's code and feel guilt free about it.
which day were you working on?
GLHF everyone
Language Roulette: Day 22
The language is ... Julia
GLHF
<@&518565788744024082> Good morning! Day 22 is ready to be attempted. View it online now at https://adventofcode.com/2023/day/22. Good luck!
my code isnt working for some reason π¦
im gonna lose it
:ooo congratulations!
I'm losing it, why am I getting the wrong answer on the real input
What edge case am I missing lol
Congrats
Are you ||sorting the bricks||
I had this issue
Yes
Oop
You can see my code in the spoiler channel
haha i didn't even ||sort the bricks||
my solution was the worst you could ever think of
i sorted the bricks
what to do
uh
why part 2 wrong
why part 2 wrong ;-;
work for test input
not for real
:(
Wtffff
Man I failed so hard today
First I failed at reading
And then I failed at writing
my part 2 no workkk
how are you doing aoc on a plane
what wifi
I canβt believe I paid for the expensive ass $40 plane wifi only to get 6 points
Itβs usually like 8 bucks
But on this flight it was 40 for some reason
how do part 2
imagine "failing" and still getting t100
top 100 is NOT a failure
coming from an average aoc participant
anyways why does my part 2 not work
Like yesterday and the day before I genuinely couldnβt solve part 2 in time at least
it was a fluke, really
it ||accumulates the bricks that can fall and subtracts the bricks that can't fall from it||
R u checking falling in order
And removing fallingones before checking next ones
||```py
sup is a list of the bricks that a certain brick supports
cache = [*map(len, sup)]
newcache = cache[:]
nmin = [0]*len(cache)
for j in range(len(sup)-1, -1, -1):
x = sup[j]
for i in x:
if nsups[i] == 1:
cache[j] += cache[i]
else:
nmin[j] += 1
p2 = sum(cache) - sum(nmin)
Oh wow you did this completely differently from me
yk speaking of plane aoc
i recall doing a day on bart
didn't think i even t1000'd that one
and it was an impl day asw
I'm really not seeing my bug, wtf
can u help wit my code.. pls
Same here LMAO
Is it in #aoc-solution-hints ?
k i'll post it there wait
I'm the only one to post in the spoiler channel so far and it doesn't even work
what time zone ru in
what region of the world is that
china
I'm also in shanghai 
massive
Yooo youβre from the bay?
Lowkey train is more rocky than plane
Head would hurt
Also it goes underground and u lose internet anguishe
Ayy I have landed sfo
since when did Discord start working in China? π€
You on VPN?
shhhhhh
Aoc's still going on?
Yeah. Last day is the 25th
Hello
hi
i am soooo glad i have a display_visited function leftover from last year's aoc
so nice
also nice to see ||my guess about day 21's assumption last night in bed was correct||
21 part 2 was terrible and i kinda cheated but i dont care tbh
define cheating?
I looked at solutions and hints
I never would have gotten it by myself
It didnt even occur to me to look at my input
Dw im not in the leaderboard
3 more days left....
I wouldn't say that is cheating. If I am completel stumped then I do that as well
How many do you think will be "hard"
I don't think there will be any more 3d processing thankfully
beacons?
2 hard ones probably
25th is usually easier
usually i think difficulty peaks around 18-22?
oh no we havent had beacons yet
yesterday was a pretty fast day, global lb finished in less than a half hour
yesterday? fast??
compared to 21? yeah
because I heard some horror stories about that one
oh no you're right, 22 is today
still on 19 XD
but it was before i slept and thus i'm calling it yesterday
still havent solved 2021 beacons
2022 beacons was a little more doable
ah fair, makes sense
but is a very cool problem, hard yes but very cool
yup
I feel like the trend of needing to "explore" the input and discovering its specific properties to solve it continues
day 20 and 21 were again super blatant in that regard
it could just be my memory of course but I definitely do not remember ever feeling this way, to such a degree, in past years
yesterday reminded me of a 2021 day 24
like, I remember in past years there were things where you didn't need to use LCM because a bunch of numbers were co-prime... but LCM is like grade school arithmetic anyway
we've already have like, at least 3 days where the "full" solution would be crazy, but when you realize the specific properties of the input it's actually quite easy
so the main challenge is actually just verifying those properties
For day 20 part 2, as soon as I read the vaguest hint about it, I immediately understood where it was going, I made all the assumptions, and it worked
I'd be curious if this is an intentional change by the creator if they do not see it that way
There were 2 beacons puzzles? There was 2021/19 which was fun. rotating groups of beacons and matching them up. What was the other one?
msj co 23!!
i remember using cv2 for beacons
not at all the same kind of puzzle but I remember when I read this puzzle title I got war flashbacks to 2021/19
https://adventofcode.com/2022/day/15
Ah yeah, more beacons! I'd completely forgotten about that one.
cheats. π
but cleaner than this mess:
||
psub=lambda p1,p2: (p1[0]-p2[0],p1[1]-p2[1],p1[2]-p2[2])
padd=lambda p1,p2: (p1[0]+p2[0],p1[1]+p2[1],p1[2]+p2[2])
rotate=lambda s,a,b,c,i,j,k: (a*s[i],b*s[j],c*s[k])
rotations=lambda scan: {r: {rotate(s,*r) for s in scan} for r in orientations}
mhd=lambda a,b: abs(a[0]-b[0])+abs(a[1]-b[1])+abs(a[2]-b[2])
||
yeah, i like when i can apply my esoteric cv2 knowledge
i had a fun day 5 solution
for 2021, where you had to do lines, but i got cv2 to do it
haha yup i had to find the day as well but I remembered the puzzle was there
The only time knowledge of another library really helped me in aoc was the time I had just helped someone with a CRT question on learnpython and the next day was a CRT question on aoc.
'part 2:', sympy.ntheory.modular.crt(m,r)[0]
my utilities has crt in it now
I really should start using your lib, or write my own, instead of reinventing the wheel every year.
but i did actually take number theory once upon a time and the only thing i remember is crt and quadratic reciprocity
i think we spent a week proving quadratic reciprocity like 4 ways
jeeze, I'm lucky I remember pigeon hole.
like almost all of the math I learned way back when has faded to fuzzy memory. as long as I can remember something loosely exists I can google it.
wait until we need to solve some quadratic equations modulo something and i'll flex on all these fast guys
or i won't because they know already
the math i use now is too specialized to do me any good in aoc
I remember a decent amount of math but none of it is relevant lol
it's all continuous stuff; tons of courses on calculus, analysis, etc
nothing discrete?
formally, no, except for some counting (i.e. in probability/physics classes)
it's mostly just pure math and CS people who do significant amounts of discrete math
outside of that most fields use a lot more continuous math
I hope there are more maths days but I know it's not coming
We already had quite a few earlier (18,20,21)
The channel name clearly states advent of code
Waiting for something to hit my speciality and then realizing I might not have one it can hit. π
π€
omg i remmeber this day
i hard coded every possible orientation
and spent 6 hours figuring out why my code wouldnt work
then i j went to sleep and solved it in like 30 min the morning of
sleep is either underrated or under-utilized. π
I hard coded them at first, and then realized I could generate them, and then went back to the hard coded version anyway.
My fav days of all time are probably day 24 2021 (the one with reverse engineering) or day 22 2019 (the one with modlar inverse and geometric series)
yk i'm having kind of a hard time doing day 22 efficiently here
can someone help me debug something for 19 2? i'm going crazy here
Hi, can somebody answer me a question for d14-1, please? First riddle is that I only pull on the north side and all round stones need to go as far up as possible?
yup
I'm going through old AoC problems and I'd like some clarification for 2018 day20 part2: ||does the number of rooms include rooms along a path, or just rooms at intersections/dead ends? e.g. if input was "N"*2000, would answer be 1001 or 1?||
Thank you. I just finished D14 part 1.
My rolling algo is a bit stupid, but what I noticed: when I replace the string values for numbers, I can actually exploit some calculations. But I have to go still through the matrix multiple times. Hmpf
Alsp, part1 of 2018 day20 was a pain. wrote algorithm that looked plausibly correct, gave too high answer. Wrote a more precise algorithm, and it turns out that no, my original algorithm was correct, I just forgot to .strip() the trailing whitespace in the input.
so 3 days left, predicting ||rust||, ||typescript|| and ||python|| for the roulette
Is the answer for each puzzle btw coupled to the account? Or does everybody get the same solution for each day's parts?
There are several different inputs, but not enough to be unique for each account
doesn't it talk about the # of doors?
Today had better be nice and easy because I didn't get much sleep
GLHF
We're here, the roulette ball just takes a bit of time to land
It was the easiest way I could think of to make Advent of code a bit more analog
GLHF everyone, 5s!
<@&518565788744024082> Good morning! Day 23 is ready to be attempted. View it online now at https://adventofcode.com/2023/day/23. Good luck!
pathfinding :(
^
Language Roulette: Day 23
The language is ... JavaScript/TypeScript
1 prediction down
Your prediction power is impressive, use it wisely
YOOOOO
Nicely done
I can't quite get ||my heuristic for the path that will be the longest|| right
||heuristics aren't necessary||
Bruh
how long would a ||brute force for p2|| take?
More than 17 minutes
hmm
today I decided to treat myself and write a nice solution with ||networkx||
part2: now solve an NP-complete problem
Lmao
Maybe you could ||collapse some of the paths|| and it would run faster?
||that is precisley what i did!||
I see how the input is structured but honestly I don't see how that would speed up my searcher
Why does this work lol
im getting wrong answer for some reason π©
i got just 75 π
OH SHIT
No wonder
BRO WHAT
I thought I fixed the issue
but I'm still getting 175
oh
I just didn't fix it lmaooo
How long does your solution run in lmao
Should I wait mine out
π₯³
<30 seconds
how do i do part 2
pain and suffering
oh
^
i ||simplified the graph by collapsing corridors|| and it still took me >10 minutes because networkx is slow as fuck. probably a handwritten bruteforce would be much better.
wdym by that
it's such a shame that the premiere graph library for python with all the fancy algorithms is also pure-python.
||if b is only connected to a and c then you can just have a path between a and c||
i have no idea how to do that with my current code but i'll go for it nonetheless
I'd recommend ||converting the grid into a neighbor dict||
(AFAIK there's no solutions other than bruteforce with various optimizations because this problem is NP-hard in general (though not sure if it's NP-hard on a grid, probably yes). some people used ||heuristics||, which makes it much faster but is hard to guess at.)
grid -> planar graph -> i don't see anything about that which makes the problem less np complete
ok i made a solution that works for the TI, fails for RI
do i have to bruteforce this
I don't see why collapsing corridoors is so effective but it worked for me...
Yes it's NP hard.
I'm really bad at such problems - I like knowing what I have to do
for part 1 I overkilled it using topological sorting so was not that fast
im so confused on day 22
my solution worked for p1, doesn't work for p2
and i just found a bug that means it shouldn't have worked for p1, so i just got lucky?
and it still doesn't work
just figured it out
somehow my two bugs just cancelled each other out and gave me the right p1?
Strange things can happen
truly wild
won't be able to make it today or tomorrow but it was fun while it lasted
see you all next year
(or in june if we're doing roc :)
||brute force :D||
any way for me to uh
have a type annotation that specifies
"you can index this and it should give a string as a result"
typing.Sequence[str]
I don't believe it is, it has several crucial things that don't have an alternative
yeah
though iirc now the collections from collections.abc are preferred
eg collections.abc.Sequence
that name is so much longer tho π
from collections.abc import Sequence :D
import collections.abc as typing
typing.Sequence[str]
``` g
The ironic thing is that by making list and dict more convenient built in type annotations
They discouraged indirectly using Sequence and Mapping
Which should be used a lot more often
so true
I SOLVED DAY 17 LETS GOOOOO
AFTER FIVE HOURS
and not understanding the solution
i made some sense of it
still need to figure out why this ||modified version of dijkstra|| works lmao
why are the days scrambled on the website
would anyone here be kind enough to help me out with day 21 part 2 π my thing works for all the test cases provided but not the right answer for my input and ive been at this for 2 days now and idk whats wrong
wanna tell me your approach/code in the solutions thread?
no guarantees i can help you out but i'll try
wait do I ask this in the spoilers channel or the solution/hints channel
idk i'm more acccustomed to speaking there so
collections like collections.abc.Callable π₯΄
!d collections.abc.Callable
class collections.abc.Callable```
ABC for classes that provide the [`__call__()`](https://docs.python.org/3/reference/datamodel.html#object.__call__) method.
day 23 ... definitely no time to solve this today, just caught up with day 17 as winter break is finally here
but first thoughts give me ||longest path in a DAG|| which should just convert to ||shortest path in the negated graph||? i think there might be something fishy with the slopes, though. and since ||the graph is unweighted|| there might be a much easier way
longest path in a graph doesn't translate to a nice shortest path problem
in fact, it's an NP-hard problem https://en.wikipedia.org/wiki/Longest_path_problem
In graph theory and theoretical computer science, the longest path problem is the problem of finding a simple path of maximum length in a given graph. A path is called simple if it does not have any repeated vertices; the length of a path may either be measured by its number of edges, or (in weighted graphs) by the sum of the weights of its edge...
however in part 1 ||the directedness of parts of the graph makes things easier||
and even in part 2 ||you can reduce the problem to a pretty small graph where attacking the NP-hard problem is feasible||
why does your laptop look wet
think it's just the texturing
does NP hard translate to "it needs to be bruteforced"
i have no clue what that means
do you know what big o notation is
i'm willing to bet money p != np
do you know what a polynomial is?
you need subscripts on those a's
def polynomial(x):
coefficients: list[number]
return sum(c * x ** n for n, c in enumerate(coefficients))
essentially
so there is the class of problems called NP where we can verify a solution in O(polynomial(n))
like Ξ£_i=1^n aα΅’xα΅’^i?
i=0
ok got it
and the class P where the problem is also solvable in O(poly(n))
P is a subset of NP
NP-hard means "this problem is as hard as any other problem in NP"
and longest path is one of those NP-hard problems
as hard as a bunch of other problems we also don't know how to solve efficiently
so basically it's just problems that take the most time to solve?
NP-complete problems are problems where we know how to verify an answer efficiently, but we currently don't know if we can also solve them efficiently
the open P=NP problem is asking whether all problems that can be verified efficiently can also be solved efficiently
personally, i'm 99.999% sure p != np
but maybe one day the next turing will come along and prove it is
will prove that it's undecidable
π
annoyingly p != np is the annoying case to prove
π
which is about non-deterministic computing
speaking of nondeterministic, i was think of trying non-deterministic solutions to yesterday
like implementing https://en.wikipedia.org/wiki/Ant_colony_optimization_algorithms on the graph
does comparing P with NP using > or < make sense
i.e. imagine some non-deterministic program, is there any possible outcome where it solves the problem in poly-time?
P is a subset of NP
so the subset symbol would be relevant
which is kinda β€
if you can solve a problem in polynomial time you can verify it in at least polynomial time by just solving it, so P <= NP
is there such a case that NP would take more time than P
or is it always that the time taken by NP is equal to and potentially less than P
but with the set relation rather than an inequality
I mean yeah there are plenty of specific problem instances where a "harder" problem can be solved fast, while an "easy" problem can take long time
like solving an NP-hard problem for tiny inputs, while solving a P problem for hugr inputs
day 23 is gonna be interesting to see the solutions for
i'm doing it now and i've become painfully aware how little graph theory i actually know
asymptotics don't say much about absolute running times
you don't actually need that much of it
for sure the stuff you need you already know
rn i'm trying to conceptualize a ||longest path algorithm on the graph||
||does dp work?||
what's the dumbest idea you can come up with?
(and can you implement it well)
((mine took 12 minutes but someone managed to get 23 seconds))
mine runs in 0.6s, but that's after a bunch of improvements
my initial thing took like 2 minutes
right, but our input is ||acyclic||
||not for p2||
is day 25 always easy
and since ||you can't backtrack|| it might as well be ||directed||
i don't know
Yeah, usually
these are my first thoughts lol
it's usually easier yeah
not reading this spoiler bc i don't know to what extent it gives away day 23 lol :P
and ||only 1 part||
my p1 gives 93 for the test input 
it gives away what the twist is
Not very much (IMO), but it is in reference to part 2
missed counting the first or last step?
an error in graph construction i think
so yeah
for the test input, it takes 15 steps to reach the first fork from the start right?
oh did you ||immediately reduce the graph to the minimal thing||?
or just doing the grid wrong?
||yeah||
oh i just wrote 0 instead of 1
Lmao
lol
I did the reduction only after badly solved p1
but I also did the slope logic
it gets pretty intricate
which part fails? the "immediately" or the "right answer"? π
Sounds like ||you're pruning too aggressively||
