[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: brute.jpg (158 KB, 1000x1418)
158 KB
158 KB JPG
BRUTE edition

>Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. People use them as a speed contest, interview prep, company training, university coursework, practice problems, or to challenge each other.
https://adventofcode.com/

/g/ leaderboard join code:
796940-44255af5
anonymous-only leaderboard:
383378-dd1e2041

previous thread: >>103481467
>>
File: aoc.png (64 KB, 756x343)
64 KB
64 KB PNG
Average time of the first 10 submissions to get both stars.
>>
>>103487554
Nice colors
>>
>>103487465
Did the old thread get deleted because someone posted Bluey porn?
>>
>>103487575
big if true
>>
File: image (1).png (105 KB, 914x705)
105 KB
105 KB PNG
>>103481623
Simple recursive Mathematica solution
>>
>part 1
>okay I"ll just do a simulation with an array even though I know part 2 is going to be a performance constraint
>part 2
>Yep
>hmmmm
>so most of the array is small numbers
>and the same number will always have the same result after n iteraitons
>therefore, I will for the first several natural numbers precompute how many states it decomposes to after 1-35 iterations
>write a recursive function that uses the lookup table to abort early when possible
>Try it
>still to slow
>reduce it to 30 iterations
>still to slow
>end up with some clusterfuck where I find the first 35 iterations for 0, the first 30 for 1-20, the first 25 for 20-100, the first 200 for 100-10000
>Try it
>it gets to recursive depth 73
>fuck
>i know
>I could use the lookup tables to make even bigger lookup tables
>it's actually really fukcing hard to write that with how I had it implemented
>still it could wait
>Wait a fucking second
>i can just instead do a simulation, but map each number to the number of occurences of that number
>delete everything
>paste in my part a solution
>finish in 5 minutes
think before you implement bros
>>
File: 11.gif (409 KB, 1000x707)
409 KB
409 KB GIF
Don't blink
>>
>>103487465
where's each day calendar picture guy, and no i m not talking about the retarded idiomatic fag
>>
File: 1658823150759248.jpg (16 KB, 200x356)
16 KB
16 KB JPG
>>103487702
holy kino
>>
>>103487702
phantazdig
>>
>>103487702
very cute
also shows that the story is taking on horror elements
is Eric doing OK?
>>
>>103487702
You can do the graphics when /g/ makes its own AOC clone. (Don’t worry, this will never actually happen).
>>
>>103487723
bro the world is literally ending

no thinking person is okay
>>
>>103487702
>Makes the best (and only) OC in /aocg/
>Nope not good enough, I must transcend it and make them gifs as well
I KNEEL
>>
>>103485693
doing that like i did is slower, though i found it a little more readable. rewrote it to do the log10 way though, just because i figured out how it worked
>>
>>103487465
so is the challenge for us to recreate Brute Force?
>>
>>103487736
TDS.
>>
File: hqdefault.jpg (14 KB, 480x360)
14 KB
14 KB JPG
>>103487702
it doesn't work
>>
>>103487702
Very nice. I almost expected the last scene to be only stones.
In fact Eric and the bigboy maker missed out on letting the number of stones approach the mass of Pluto or Charon as an easteregg. At least for the bigboy, it works out if each stone has a mass of about 2 metric tons.
>>
>>103487554
>every average for 2024 is below three minutes, most below two
fuck ai
>>
File: 1733962272169.jpg (20 KB, 299x168)
20 KB
20 KB JPG
>>103487702
>>
>>103487845
nah, TDS sufferers only think that "our democracy" is ending. Apocalypse-fearers get that from the constant prodding of nuclear powers. It's grim but too large in scale to really have horror elements, so it shouldn't be what's bothering Eric.
>>
Be sure to brush up on constraint solving problems.
>>
eric should have made the problem be indexing the stone at some position
RLE seems appropriate for day fucking 11 this felt like a day 3 problem
>>
File: 2024-12-11_19-25.png (118 KB, 718x958)
118 KB
118 KB PNG
>>103481623
73ms with LuaJIT, 126ms with Lua 5.4.7
>>
>>103488027
it was literally a day 6 problem before.
>>
Is this solvable in general? With a less nice number than 2024 the # of unique values grows exponentially.
>>
File: file.png (91 KB, 1173x870)
91 KB
91 KB PNG
>>103485693
>>103487815
i benchmarked it out of curiousity, surprisingly its less of a difference than i thought it would be

import math

def numeric_split(number):
num_digits = int(math.log10(number)) + 1
divisor = pow(10, num_digits // 2)
return (number // divisor, number % divisor)

def string_split(number):
string = str(number)
midpoint = len(string) // 2
return (int(string[:midpoint]), int(string[midpoint:]))
>>
>>103488027
It was trivial once you knew RLE worked, but getting there is nontrivial
>>
>>103488027
This was day 12 last year
>>
>>103488027
This is unsolvable by brute force, hardest problem we've had
>>
>>103488257
Don't let truth get in the way of anons whining and later getting filtered
>>
>try to brute one element at a time
>grinds to a health at around 147m elements in the array

yeah ok fine eric I will do your dumb dp problem
>>
>>103488274
How long did this take you and why did you even try?
>>
Honestly, just counting the stones made me a bit disappointed. It reminded me a bit too much of the IQ-test in idiocracy where the main character is asked how many buckets he has.
>>
>>
I'm really disappointed in the brooters, I thought you'd find a way, alas you failed. You only had to ask the NSA to shut down operations for a while and run your program, but you didn't. You could have even created a worm to run a sort of folding@home type distributed effort, but you didn't.
>>
File: 1733887359530571.png (629 KB, 822x744)
629 KB
629 KB PNG
kinda stupid XX anon from last here; I fucking did it! I did it! It took me 4 hours of thinking and now I have a headache and I have no idea if I'll pass tomorrow but I was able to dynamic program today!

I'm still on the leaderboard! suck it!

{
for(i=1;i<=NF;i++) {
p1+=recurse($i,25)
p2+=recurse($i,75)
}
print "Part 1: " p1 "\nPart 2: " p2
}

function recurse(number, depth, count) {
key = number SUBSEP depth
while(!a[key] && depth--) {
if(!number) { number = 1; continue }
if(length(number)%2) { number*=2024; continue }
n += recurse(substr(number,1,length(number)/2), depth,
0>number=+substr(number,length(number)/2+1))
}
if (depth > 0) a[key] = count+1
return a[key]
}
>>
>>103483012
That only applies for easy problems.
>>
>>103488357
>XX anon
>suck it
You will never drop your Y chromosome.
>>
>>103488284
less than 5-10 minutes for the first 40-45 or so iterations actually
>>
https://status.openai.com/
ohnonono llm sisters....
>>
>>103488390
It'll be fixed by then.
>>
>>103488390
fuck how am I going to goon now
>>
>>103488390
>https://status.openai.com/
NOOOOOOOOOOOO
I WILL NOT BE FILTERED
I WILL NOT BE FILTERED
I WILL NOT BE FILTERED
SAVE MEEEEEEEEEEEEE!!!!!!!!!!!
>>
>>103487702
kino
>>
>>103488390
It would be so funny if the leaderboard times triple today
>>
>>103488390
>>103488445
>>103488447
>>103488451
>LLMlets will finally be filtered
Oh no, it's so sad, I'm crying bros
>>
>>103488445
dont jinx it nigger
>>
chat- /g/ pee tea retards btfo
>>
>>103488473
probably some of them at least have claude or gemini as a backup
>>
>>103488027
>RLE seems appropriate for day fucking 11 this felt like a day 3 problem
difference is this time it's a lot easier to overthink and try chasing some crazy dynamic programming solution
>>
>>103487554
Just checked 2019 10 and it's virtually just a variation of 2024 08.
Eric is creatively bankrupt.
>>
>>103488524
Orders received, I am pivoting to posting the fast leaderboard times and claiming it is all legit, since chatgpt is down.
>>
>>103488379
"Suck it" is an insult and "eat it" is not, anon. Would love it if they were both insults, but sadly they are not.
>>
>>103488390
praying that openai engineers all got hired by using chatgpt rn
>>
File: explode.mp4 (782 KB, 720x720)
782 KB
782 KB MP4
>>103488451
>tfw you pay $200/month to get on the vaunted leaderboard and OpenAI fails.
>>
>>103488640
>POV: It's december 26 2024 (the final year of AoC has just come to a close)
>>
>>103488640
o1 is slow, these llm cucks must be using claude or something
>>
>>103488185
got similar results when i perf'd my own code - yes, i was right, it's slower, but not nearly as bad as i thought it would be.
>>
>>103488685
o1 still beats claude
>>
File: f# day 11 silver.png (41 KB, 687x713)
41 KB
41 KB PNG
Alright, now for part 2
This is gonna get ugly

I read some posts about memoization but I have no idea what that even is
>>
wtf is this latern fish talk? Lantern fish was wildly different. The recurrence relationship is literally plain as hell and only needs constant storage (barring integer).

It was still easy, but I don't think it's equivalent in the slightest.
>>
File: here we go.png (4 KB, 394x99)
4 KB
4 KB PNG
leggooo
>>
B-broot chads..
>>
File: Untitled.png (5 KB, 995x117)
5 KB
5 KB PNG
human bros not like this
>>
Today was a high IQ filter. Smart people recognised the generally unsolvable nature of the problem, low IQs were't out off and stumbled on the special case solution without even realising it was special.
>>
>>103488738
>List.length instead of List.sum

ngmi
>>
>>103488738
nope
how do I even solve this?
I've never had to do anything even remotely close to this. Am I actually filtered by some stones in a straight line?
>>
>>103488809
you don't have the memory for that List.length to ever work.
>>
>>103488809
The values chosen are convenient and lead to a property of the stones you might not expect
>>
>>103488806
I'm learning F#. This is my third week using the language, but even then List.sum adds up all the elements. I could be wrong but I really don't see the point of sum here
>>
File: day 11 part 2.png (3 KB, 441x63)
3 KB
3 KB PNG
>>
File: file.png (86 KB, 799x799)
86 KB
86 KB PNG
Just solved all of year 2023
>>
>>103488357
proof you're a biological female?
>>
>>103488832
Total number of stones is too large. There's a way of encoding each state that would involve summing at the end. n.b. your data would be a little more complicated than a list of ints, but not much.
>>
>>103488864
I enjoy programming but it still took me four hours of thinking to do a piss-easy dynamic programming problem?
>>
Unrelated but what text editor(s) do you guys use? Need a good GUI code editor (that works on both linux and windows). VSCode and Clion are kinda bloaty imo
I was thinking of making my own, but I can't find a good widget toolkit to use atm
>>
File: axel.png (905 KB, 1920x1080)
905 KB
905 KB PNG
>>103488874
Alright then
>>
File: broot fail.png (10 KB, 379x102)
10 KB
10 KB PNG
chrome crashed btw

>>103488865
I'm trying to think but I'm literally stumped kek
I don't want to give up but I don't even have a clue to work on
>>
>>103488878
Oh, forgot to mention: I tried codeblocks, dev-c++ and geany. They all don't do it for me.
Also, "in-terminal" (i.e ncurses) GUIs are fine too.
>>
>tfw 18 stars for 2017 and I don't even remember doing it.
>>
>>103488914
Try looking at each list of stones and see if anything reoccurs?

Not sure how much of a hint you want, there are solution itt you could be checking after all.
>>
>>103488878
>I want A text editor with no bloat
Vim or emacs (I'm on team vim)
>Inb4 seethe because in reality, you do want bloat
>>
>>103488933
I'll try to look for patterns in the numbers I guess
>>
>>103488914
Stones with the same number are identical and repeat. You can use that knowledge to compress storage needs and operations on said stones.
>>
>>103488878
Vim. I don't have any particular need for NeoVim's features, but NV is fully back-compatible, so I'm sure I could use either.

>"in-terminal" (i.e ncurses) GUIs are fine too
NV supports the mouse by default. There are also a litany of plugins that give it IDE elements like a file tree, menus, tabs, tab-complete, etc.
>>
>>103488878
Vim+tmux. You really only need to worry about editors for large projects, could do AoC in notepad.
>>
The trend seems to follow exponential curve nearly perfectly. Any O(1) solutions mathfags?
>>
File: xkcdconj.png (50 KB, 311x452)
50 KB
50 KB PNG
>>103488979
Not a mathfag, but I dont think so.
>>
>>103488357
>awk
Yeah, this checks out; only a woman would choose to stick with a language for aesthetic/self-constraint reasons but still struggle to code in it.
>>
>>103488728
Ok. I did some maths and it looks like this problem has a linear recurrence that's slightly dependent on the starting values. I guess it is lantern fish but it's only realistic to use a hashmap.
>>
>>103488728
After 100 blinks the recurrence is probably simple and only needs constant storage
>Source: I believe it to be true
>>
>>103488878
You will never get a fair sample because vim larpers are 10x more likely to answer
>>
>>103488357
>awk
woman momento
>>
>>103488878
vscode or vscodium
its simply the best
>>
so how much would it cost me to rent a cloud computer to broot it?
>>
>>103489096
Someone on r*ddit did it for $80
>>
File: relative heatmap.png (607 KB, 2646x1408)
607 KB
607 KB PNG
Can an AOC oldfag rate my difficulty heatmap? Basically it compares a day N to other day N's of different years. If, say, day 18 of 2019 filters a lot more people than other day 18's, it's considered "hard"
>>
>>103489053
I did it optimized for a few thousand blinks, I don't see any pattern emerging where it'd stop needing storage
>>
>>103489114
>reddit is outbrooting us
grim
>>
>>103489082
Let me guess, anon, you need more?
>>
>>103489122
how are you comparing them? is it the percentage drop off from one day to the next?
>>
File: aoc11.png (320 KB, 1280x3196)
320 KB
320 KB PNG
>>103488274
ok I did it properly since the bruteforce array building would have taken too long and maybe even run out of memory

I hope I made you proud eric
>>
>>103488357
>>103488864
Proof was requested yesterday, following the rules of old and standard procedures. Verification is still pending.
>>
>>103489122
where is 2024
>>
>>103489297
aoc is a wholesome thread go back to b
>>
>>103489297
>"Why won't this internet stranger post her tits? I just want proof she's female"
>>
>>103489317
How far has this board fallen. I cannot believe that this actually needs to be explained.
>>
>>103489282
Percentage of day 1 completers that were able to complete a given day. Differences on the map represent how much this measure deviated from the average year.
>>
>>103489295
Based and not Fortrannies.
>>
restored honor to my household by finally doing my day 8 solution properly. now i have to get caught up on day 9 and 10
>>
>>103489297
those rules were written before AI image tools; how on Earth am I supposed to prove it now?
>>
File: stars.png (4 KB, 102x282)
4 KB
4 KB PNG
I think I understand how to do it but I'm too tired. I'm giving up this star I believe
>>
>>103489452
tits with timestamp
>>
>>103489506
It's pretty simple honestly. Just iterate over a counts dictionary.
>>
>>103489520
and Awk(ward) code in the background.
>>
>>103489122
Was 2019 really this based?
>>
>>103489528
>Awk(ward)
is that what it really means? makes too much sense
>>
>>103489528
GTFO then. I don't make the rules.
>>
>>103489536
no it stands for Aho, Weinberger, and Kernighan (last names of the people who created the lang)
>>
>>103489542
can hardly believe three different people got to agree on that syntax
>>
>>103489533
Yes. IntCode was the most fun I've had with AoC. At some point I put it on an "IntCode" processor on an FPGA to solve a problem.
>>
brutefags in 3023 be like
grandpa why don't we need heating?
well, hundreds of years ago, long before DP was invented...
advent of code, 2023, day 12, part 2
https://www.youtube.com/watch?v=m2WEZngxDFQ
>>
Imagine needing more than 10 lines of code for this

let memo = %{*: go(it)}

function go match {
(_, 0) => 1,
(0, n) => memo[(1, n - 1)],
(str ~> s :: (#s).even?(), n) =>
[*s.split(#s / 2)].map\(memo[(int(_, 10), n - 1)]).sum()
(k, n) => memo[(2024 * k, n - 1)]
}

print(slurp().words().map(int |> go@((_, 75))).sum())
>>
>>103489561
>posting after gpt came back up
>>
>>103489542
>Weinberger
haha
>>
>>103489557
>World enters a new dark age.
>Somehow the butefags machine still runs.
>Future historians find it,
>Cherish the example as one of the most significant finds of their lives.
>It's just some tards shit code.
Many such cases, we actually have (and cherrish) Roman shit posting.
>>
>>103489557
>advent of code, 2023, day 12, part 2
mine was running for more than a week and had not completed when I needed to stop it
feels bad
>>
>>103489552
it must have been a breeze of fresh air at the time
then came perl and mogged the shit out of awk
>>
>>103489567
gpt doesn't even know this language exists. cope harder
>>
>>103489520
this has always been really stupid way to prove XX when biological males have had access to HRT for decades before 4chan even existed.

this has been a great segue into my hypothesis is that /g/ is the worst 4chan board. this is a blue board and we're still demanding tits with timestamp.
the reason /g/ is the worst is because IRL being a geek makes someone special really unique

on the internet that's a (almost) a given.
>proclivity

if i prevented tits from being posted i'm genuinely sorry as tits are awesome

although if we're objectivizing wammin an obsession with titties is kinda childish (lactation fetish hello)

women are beautiful from head to toe ngl

</simp>
>>
>>103489613
>>103489552
Don't forget Ruby! I used awk and Perl a lot back in my sysadmin days and then Ruby for early web dev.

>>103489520
Fine; I'll upload 'em soon.
>>
>>103489542
Most people will know Aho (Dragon book) and Kernighan (C programming). That is, those of you born of the age when men read books over watching "tutorials"
>>
>>103489616
kys
>>
>>103489616
>this has always been really stupid way to prove XX when biological males have had access to HRT for decades before 4chan even existed.
1. They didn't. That's a new phenomenon.
2. HRT doesn't give you tits. It gives you disgusting man-boobs.
>being a geek makes someone special really unique
maybe back in 2008 or so; good times

Anyway, I've dragged everyone off topic. What's the next day gonna be, do we think?
>>
>>103489610
Even better if it is not outputting anything.
>it's running, calculating something but what, nobody knows
>and so it runs, and onlookers wonder what mystery it will solve when it completes
192205647839165
>what does it mean?
>>
>>103489542
common misconception. i emailed bwk for clarification on this and he admitted to me that it actually stands for Another Win for the Kikes
>>
>>103489656
Constrain programming. Limited resources, find an optimal allocation. Part 2 will be the same, but just harder for bruters.
>>
>>103489616
This is the most femoid post I've read in awhile. Frig off.
>>
>femcel mommy milkers
>>
File: a4E4wNw_460s.jpg (33 KB, 460x460)
33 KB
33 KB JPG
>>103489630
>Fine; I'll upload 'em soon.
>>
instead of "tits or gtfo" now I just say "ywnbaw"
>>
please can we talk about programming again
>>
>>103489616
The reason for "tits or GTFO" is that it's easy for anyone to claim to be a woman and get attention for it on an anonymous board. It's a protection mechanism, faggot.
>>
>>103489732
how do I program my xy chromosome into xx
>>
>>103489753
There's a crate for that.
>>
>>103489653
no u
>>103489656
1) yes (maybe not legally or subsidized by insurance)
2) thinking back to middle school when I was first exposed to MtF pornography, again u r wrong
>>103489681
i'm trying to reintegrate into this cesspool for literally 0 reason whatsoever
>>103489681
i'm so proud of you for reading my post, now remember just because (my) logic makes you feel like a girl, doesn't mean that there's anything wrong with my posts ;)
>>103489720
it's so sad that the incels have found this once splendid domain
>>103489748
it's 2024
dead internet theory
worry about fighting artificial intelligence instead of girls
>>
One of these years AOC needs to do a problem where it feels like there's some super clever graph theory or obscure data structure you can use to solve it but no it's literally just brute forced and you have to come up with a dozen hacky tricks to prune the solution space enough for it to be able to complete in a reasonable time
>>
>>103489799
sounds like a few days in 2022
>>
>>103489799
I thought that already happened
>>
>>103488390
Oh yes it's still down, can't wait to see the fags who magically disappear from the leaderboard.
>>
>>103489760
kek
>>
>>103489748
or you could just ignore obnoxious attention seekers instead of giving them what they want
>>
1 HOUR
>>
File: 1721660699018566.png (38 KB, 998x267)
38 KB
38 KB PNG
Bigboybros, has reddit outplayed us?
https://www.reddit.com/r/adventofcode/comments/1hbtz8w/2024_day_11_every_sequence_converges_to_3947/
>>
I miss waking up at this time for showtime but my sleep schedule remains dildos
>>
File: aoc_2024_11.png (54 KB, 827x790)
54 KB
54 KB PNG
Another Perl.
I wonder if trying to pre-compute something like 5 steps for 0-9 and other common values and trying to operate on the entire array in those increments can speed up even more. There's probably not that many unique numbers.
>>
>>103489799
the issue with writing these problems is you can't really anticipate how they'll be solved - you can put constraints on them to make them harder to bruteforce, but it was only yesterday that bruteforcing the problem became actually infeasible. at that point, if you have to really heavily edit and reshape the problem to make it unbruteforceable, aren't you just pushing the solver towards one "true" solution, like you would be if it was bruteforceable to start with? isn't the point that there are multiple ways to solve?
>>
>>103489858
literally impossible. the reason they keep doing it is because it works, the reason it works is because we keep falling for it. imagine in any other situation asking the person being stupid to not be stupid.
>>
>>103489937
Two anons made transposition-matrix solutions, so that fixed size isn’t unknown to “us”.
>>
>>103489937
We literally talked about this at length.
>>
had a dream that today's puzzle required you to solve it in lua
>>
File: fail.mp4 (1.2 MB, 720x720)
1.2 MB
1.2 MB MP4
Just take the painting off the wall you stupid AI.
>>
>>103489986
Pretty sure someone solving the problem with the transposition-matrix approach did not in any way imply all inputs would converge to a finite number of cycles.
>>
>>103490022
It's fucked up that this is considered a "fail". I'm getting spooked.
>>
>>103490020
and was it good or bad in your dream?
>>
surely todays problem will be brute-able
>>
File: 1733977440389.jpg (162 KB, 1079x1186)
162 KB
162 KB JPG
>>103490024
/aocg/ on the bottom
>>
File: 1733920858597236.jpg (88 KB, 720x1088)
88 KB
88 KB JPG
>>103490036
say that again, anon; she dares you
>>
>>103490024
The matrix is finite. Any vector you multiply it by is finite.
>>
>>103490037
fake
the engineer forgot to tell the fire that he's an engineer when he came into the room
>>
>>103490042
i like my inputs small
>>
check day 9 /g/ delta leaderboard
>>
File: 1733776541663385.jpg (130 KB, 1280x720)
130 KB
130 KB JPG
>>103490057
>>
good morning /aocg/
>>
calendar janny where
>>
>>103490063
Ok I checked it. what do I seethe about?
>>
>>103488878
Neovim all you need
>>
>>103490080
Good morning sir.
>>
>20 minutes left
>thread is dead
it's over
>>
>>103488357
>XX anon
> I have no idea if I'll pass
You aren't XX and you don't pass
>>
>>103490116
we are here but what do I post?
Every day I only post my solution and my calendar.
>>
>>103490116
motivation would improve if instead of retarded ascii art it was a elf that would strip for every star
>>
>>103490122
nobody cares about your calendar
>>
>>103490116
guess people did get filtered
>>
>>103490138
big true
>>
>>103489937
bigboy contained <4k unique numbers so static hashmaps wouldn't break
we're like 8 moves ahead
>>
>>103490132
I can picture an early 2000's website that does this.
>>
>>103490043
>The matrix is finite
For the tested inputs. That dose not mean shit for the generation problem statement.
Collatz conjecture has been shown true for all positive integers up to 2.95Ă—10^20.
That doesn't mean it's also true for the numbers beyond that,
>>
>>103490132
that would be based, make an advent of coom
>>
>>103490138
>>103490143
I know, that's not why I post them.
>>
>>103490148
bless the 2000's. link?
>>
brooters get the rope
>>
>>103490167
I imagined it in my mind. It only exists within my mind palace
>>
>>103490141
fucking how? i'm retarded and i'm barely treading water at this point.
>>
>>103490191
people are bad at DP and people lose interest
>>
10 MINUTES
>>
RIP the brooters
>>
File: file.png (38 KB, 643x363)
38 KB
38 KB PNG
>20 SECONDS
FUCK
>>
>>103490191
biggest filter isn't puzzle difficulty. Its that people are unable to form habits and stay committed to things. Unfortunately eric keeps lowering the difficulty thinking more people will make it to the end (they wont)
>>
THE DAY OF THE WALL IS HERE
>>
>>103490191
people can't commit to anything nowdays
>>
Today HAS to be a hard day. I'm a bit worried actually.
>>
>>103488878
neovim and tmux
>>
Woke up early this time
>>
File: 1733201676061642.png (453 KB, 1858x1829)
453 KB
453 KB PNG
yare yare its that time again
>>
File: file.png (588 KB, 760x448)
588 KB
588 KB PNG
IT'S HAPPENING
>>
boys i always get filtered on day 12........ it's not looking good for me.......
>>
uhoh
my tummy is a rumbling
bros.......
the big shit is here
>>
Tired, drunk, ready to shit.
>>
>>103490182
that's a shame
>>
File: showtime.jpg (46 KB, 640x480)
46 KB
46 KB JPG
https://www.youtube.com/watch?v=hjGZLnja1o8
>>
>>103490252
cancer music
>>
>>103490252
kino music
>>
UGHHH FUCKK IREALLY HAVE TO TAKE A SHITTTTTT
>>
>>103490243
I already spent 30 minutes wiping
but it feels like I need to drop another...
>>
>>103490252
SHOWTIME
>>
File: .png (5 KB, 637x24)
5 KB
5 KB PNG
this fucking guy
>>
REDUCE SPEED. WALL INCOMING
>>
File: mokou-showtime.jpg (130 KB, 440x518)
130 KB
130 KB JPG
>>
BRUTEBROS, WE WON'T LOSE AGAIN
>>
>>103487702
CUTE!
>>
>>103490149
I didn't read the reddit article, but of course the numbers that Eric gives out will all be part of some finite group. My "stones" are part of a 3982 element group.
>>
The wall is approaching, lads.
Not like you care, because the first wall is never worse than like the 5th hardest puzzle of the year, and you're going to save Christmas anyway, right anon?
>>
BROOTBROS THIS TIME WE WIN
>>
everyone ready for some simulation today?
>>
G R I D
R
I
D
>>
it's too fucking cold to program
>>
today will be assembly
>>
FUCK i forgot to make tea
going to do that and accept being late, takes me a long time to finish anyway
>>
brootbros we get overtime if our solution is still running right? I didnt hear no bell.
>>
File: file.png (508 KB, 612x408)
508 KB
508 KB PNG
I'm ready
>>
>>103490301
agreed
>>
>>103490287
the true wall is family commitments on the 23rd and 24th
>>
>>103490303
The time only stops if you ctrl+c
>>
brutesisters where we at
>>
FUCK
>>
FUCK
>>
FUCK
>>
grid
>>
FUCK
>>
fucking grid day again
>>
input on this one looks cool
>>
This one is going to take me a while. bye bye leaderboard
>>
>wall of text
>>
kek, giant ascii COCK in the input
>>
At least part 1 doesn't look too hard
>>
how do you find the perimiter though?
>>
>>103490361
it's day 10 again except if you can translate into the adjacent node you +1 to the perimeter count
>>
>6 minutes
>write first line of code
Being a brainlet sucks. Anyway closing thread
>>
>>103490367
in the one with all Os and 4 Xes, a lot of the dumb algos I come up with want to add perimeter squares for the Os in the middle that are surrounded by 4 Xes. but I think those are inner perimeters that don't count
>>
>>103490389
oh, I just read closer and see the inner perimeter does count
>>
what's fucking me up is each region doesn't have to be contiguous - it can be spread out and completely separated. wtf eric
>>
File: day 11.jpg (446 KB, 1544x1544)
446 KB
446 KB JPG
A little late to the don't blink party

>>103487702
love your stuff
>>
>>103490361
nuf said
>>
Uhhhh
Fuck part 2 I'm too retarded
>>
>part 2
not this mathfag pipe shit again
>>
nice problem
it's basically
https://leetcode.com/problems/island-perimeter/
and almost
https://leetcode.com/problems/number-of-islands/
combined
so i just had to copy and paste my solutions and tweak them a bit
>>
>>103490466
same
im sure theres some mathfag way to do it but im too dumb
>>
> part 2
I need to shit, brb
>>
WHAT THE FUCK IS PART 2
>>
part 2 hard ;_;
>>
>topology
fugg
>>
bros i've spent the last 10 minutes reading part 2 wtf am I supposed to do here
>>
>>103490523
Are you serious? It's the same as part 1 except you use the number of sides of a region instead of the length of the region's perimeter. It's not hard to understand, it's hard to implement.
>>
I'm gonna do part 2 tomorrow I'm too drunk for this
>>
Combined parts 1 and 2, both individually were slightly too long to post.
data = open("Day 12 input.txt", "r").read().strip().split("\n")

grid = {}
for y, line in enumerate(data):
for x, char in enumerate(line):
grid[(x,y)] = char

size = [len(data[0]), len(data)]
dirs = [[1,0],[0,1],[-1,0],[0,-1]]

part1 = 0
part2 = 0
visited = set()
for i in grid:
if i in visited: continue
region = set()
queue = [i]
while len(queue):
cell = queue.pop()
if cell in visited: continue
visited.add(cell)
region.add(cell)
for dx, dy in dirs:
if (cell[0]+dx, cell[1]+dy) in grid and grid[(cell[0]+dx, cell[1]+dy)] == grid[cell]:
queue.append((cell[0]+dx, cell[1]+dy))

perim = set()
for cell in region:
for rot, d in enumerate(dirs):
dx, dy = d
if not (cell[0]+dx, cell[1]+dy) in region:
perim.add((cell[0]+dx, cell[1]+dy, rot))

part1 += len(region)*len(perim) #part 1 loop ended here

edges = 0
pvisited = set()
for p in perim:
if p in pvisited: continue
edge = set()
queue = [p]
while len(queue):
cell = queue.pop()
if cell in pvisited: continue
pvisited.add(cell)
edge.add(cell)
for dx, dy in dirs:
if (cell[0]+dx, cell[1]+dy, cell[2]) in perim:
queue.append((cell[0]+dx, cell[1]+dy, cell[2]))
edges += 1

#print grid[i], len(region), edges
part2 += len(region) * edges
print part1, part2

Best part 2 rank this year.
Basically just copy/pasted the region loop to handle edges, with one extra parameter for rotation.
>>
I think I have to triple the size of the grid, place the fences around using the new points in the grid, store the new edges, then I can make a graph out of the fences and collapse the graph to find the number of the edges.
>>
nice problem, got my first top 200 of the year
for part 2 [spoiler]I only counted a fence if it didn't have another fence above or left of it, not a very difficult change[/spoiler]
>>
>>103490407
if it can't be reached then it's not the same region, part 1 is number of islands
>>
>>103490407
Each region does have to be contiguous. Read nigga
>>
>part2
sorry bros guess this is the wall for me see you guys next year
>>
floodfill bros, it's out time to shine
>>
>>103490542
i like your style
>>
easily my ugliest program yet this year. getting tired of the 2d grid shit
>>
File: carbon.png (930 KB, 1328x5644)
930 KB
930 KB PNG
My code is pretty slow, but it works.
>>
filtered on p2 for now, did p1 on autopilot
i'll think about it later
>>
>>103490616
>>103490595
>>103490533
drooling retards
>>
>>103490626
Which solution is yours?
>>
File: carbon(56).png (601 KB, 1420x3142)
601 KB
601 KB PNG
      --------Part 1--------   --------Part 2--------
Day Time Rank Score Time Rank Score
12 00:14:38 1309 0 00:43:31 1163 0
>>
>>103490634
my solution will be revealed to me in a dream tonight
>>
>>103490643
you're one of us then
>>
File: 1732625430542292.png (450 KB, 1516x4434)
450 KB
450 KB PNG
Idiomatic Python solution
      --------Part 1--------   --------Part 2--------
Day Time Rank Score Time Rank Score
12 00:16:22 1553 0 00:44:56 1220 0
>>
      -------Part 1--------   -------Part 2--------
Day Time Rank Score Time Rank Score
12 00:16:38 1584 0 00:52:11 1571 0


I am... filtered.
>>
File: rizz.jpg (62 KB, 600x680)
62 KB
62 KB JPG
yay got p2 on my own
>>
>>103490491
Nevermind I did it
Just count concurrent edges
>>
File: UNWASHED ASS.png (300 KB, 842x2290)
300 KB
300 KB PNG
>>103490694
UNWASHED ASS EXTRA UNWASHED TODAY SAAR
>>
>>103490565
I am doing this as well, but alas it works on all the examples but not my real input, sigh...
>>
I WILL NOT BE FILTERED BY P2
I WILL NOT BE FILTERED BY P2
I WILL NOT BE FILTERED BY P2
>>
>>103490695
Yeah, it feels good.
>>
>code works on ALL THREE examples
>doesn't work on input

wtf
>>
File: file.png (485 KB, 758x379)
485 KB
485 KB PNG
IT'S HERE
>>
File: carbon.png (423 KB, 913x2484)
423 KB
423 KB PNG
      -------Part 1--------   -------Part 2--------
Day Time Rank Score Time Rank Score
12 00:24:22 2684 0 00:51:48 1554 0

I don't want to wash this shit
>>
>>103490718
Dude fucking same
>>
What's the galaxy brain way to do this?
Traverse the edge, count corners, and then compute area with Green's theorem?
>>
>>103490724
>corners
FUCK why didn't I think of this
>>
File: day12.png (17 KB, 720x656)
17 KB
17 KB PNG
>>103490728
good enough
>>
>>103490718
>>103490721
In all three examples, regions have unique labels. In my input, there are like 15 different zones with E, and 15 more with F etc
>>
can someone post their input with answers pls
>>
>>103490724
I just scanned the grid in vertically and horizontally and detected all edges.
Here is my pajeet tier code >>103490615
>>
not a hard day. had to fiddle with my corner checking. I knew what to do, just typed slow :(
      --------Part 1--------   --------Part 2--------
Day Time Rank Score Time Rank Score
12 00:24:29 2702 0 00:57:52 1828 0


part1
    bighist := make(map[rc]struct{})
ddirs := []rc{
{-1, 0},
{0, 1},
{1, 0},
{0, -1},
}
maxr := len(gmap) - 1
maxc := len(gmap[0]) - 1

ssum := 0
for r, row := range gmap {
for c, col := range row {
trc := rc{r, c}
_, ok := bighist[trc]
if ok {
continue
}
cplant := col

bighist[trc] = struct{}{}
hist := make(map[rc]int)
fmt.Println("handle region", string(cplant), trc)

var crc rc
pending := []rc{trc}
hist[trc] = 0
for len(pending) > 0 {
crc, pending = pending[0], pending[1:]
fmt.Println("cur", crc, "pending", pending)

bighist[crc] = struct{}{}

for _, dd := range ddirs {
drc := crc.add(dd)
if drc.r < 0 || drc.r > maxr || drc.c < 0 || drc.c > maxc {
hist[crc] += 1
continue
}
dplant := gmap[drc.r][drc.c]
if cplant != dplant {
hist[crc] += 1
continue
}
if _, ok := hist[drc]; ok {
continue
}
hist[drc] = 0
pending = append(pending, drc)
}
fmt.Println("curr", crc, hist[crc])
}

fsum := 0
for _, fc := range hist {
fsum += fc
}
fmt.Println(string(cplant), len(hist), fsum)
ssum += fsum * len(hist)
}
}

>>
The most unwashed my ass has been this year
No way I can put a cute 2hu as the background in the current state
>>
>>103490728
sorry for the accidental (you)
t. >>103490733
>>
>>103490736
wait nvm I'm retarded, that's not true for the X/O one
>>
>>103490736
Not in the X O example which works fine.
>>
>>103490746
part2. Yesh could've combined. I just copy/pasted and modified.
    dcorners := [][]rc{
{{0, -1}, {-1, 0}, {-1, -1}},
{{-1, 0}, {0, 1}, {-1, 1}},
{{0, 1}, {1, 0}, {1, 1}},
{{1, 0}, {0, -1}, {1, -1}},
}

for r, row := range gmap {
for c, col := range row {
trc := rc{r, c}
_, ok := bighist[trc]
if ok {
continue
}
cplant := col

bighist[trc] = struct{}{}
hist := make(map[rc]int)

var crc rc
pending := []rc{trc}
hist[trc] = 0
corcount := 0
for len(pending) > 0 {
crc, pending = pending[0], pending[1:]

bighist[crc] = struct{}{}

for _, dd := range ddirs {
drc := crc.add(dd)
if drc.r < 0 || drc.r > maxr || drc.c < 0 || drc.c > maxc {
hist[crc] += 1
continue
}
dplant := gmap[drc.r][drc.c]
if cplant != dplant {
hist[crc] += 1
continue
}
if _, ok := hist[drc]; ok {
continue
}
hist[drc] = 0
pending = append(pending, drc)
}
var p1 byte
var p2 byte
var p3 byte

for _, dc := range dcorners {
s1 := true
s2 := true
s3 := true
d1 := crc.add(dc[0])
d2 := crc.add(dc[1])
d3 := crc.add(dc[2])
if d1.r < 0 || d1.r > maxr || d1.c < 0 || d1.c > maxc {
s1 = false
}
if s1 {
p1 = gmap[d1.r][d1.c]
s1 = cplant == p1
}
if d2.r < 0 || d2.r > maxr || d2.c < 0 || d2.c > maxc {
s2 = false
}
if s2 {
p2 = gmap[d2.r][d2.c]
s2 = cplant == p2
}
if d3.r < 0 || d3.r > maxr || d3.c < 0 || d3.c > maxc {
s3 = false
}
if s3 {
p3 = gmap[d3.r][d3.c]
s3 = cplant == p3
}
if !s1 && !s2 {
corcount++
continue
}
if s1 && s2 && !s3 {
corcount++
continue
}
}
}
fmt.Println("spots", string(cplant), len(hist))
fmt.Println("corcount", string(cplant), corcount)
ssum += corcount * len(hist)

}
}

fmt.Println("sum", ssum)

>>
>>103490420
did you make those? very cute.
>>
File: file.png (574 KB, 2296x2610)
574 KB
574 KB PNG
      -------Part 1--------   -------Part 2--------
Day Time Rank Score Time Rank Score
12 00:12:44 1064 0 00:59:41 1915 0

fucking hell finally got part 2 what a pain in the ass
it doesnt even seem that hard i just couldnt do it right
eventually figured out i was counting the outer edge once for one side which prevented it being used for a different side e.g.
EEEE
EXXX
EEEE

counting the bottom of top row of Es preventing a side at top of bottom row of Es
>>
>correct answer on both examples
>too low on input
AHHHHH
>>
>>103490740
https://pastebin.com/3xkvFb9R
Part 1: 1573474
Part 2: 966476
>>
>>103490211
sorry for doubting you anon
>>
sending in the cavalry
>>
>>103490718
same here
>>
>>103489082
awk is a top tier scripting language for data wrangling althougheverbeit
>>
>>103490775
It is not really that hard, but I had to take some time to come up with a solution.
>>
>>103490771
i bet there is some super easy way to do it too
mathfags spoonfeed me please
>>
>>103490767
Why yes, I drew them by hand
>>
>>103490781
>FFFUUU
>FFFUUKKK
>FFFFUUKKKUUU
>KKK
>KKK
>KKK
Jesus christ Eric
>>
DONE
I think this is the worst code I've ever written.
I gave up with the perimeter, and did something really stupid.
then I saw part 2, and did something even more stupid.
then I saw "there's an in-side and an out-side", and did something even MORE stupid.

if there's a smart way to do this, please inform me. my code takes several seconds to run on the input, it's really bad.
>>
File: file.png (320 KB, 623x3556)
320 KB
320 KB PNG
it ain't pretty, but if it works, it works
      --------Part 1--------   --------Part 2--------
Day Time Rank Score Time Rank Score
12 00:18:30 1855 0 01:06:16 2198 0
>>
File: img-2024-12-12-07-07-51.png (311 KB, 1464x1928)
311 KB
311 KB PNG
unidiomatic Rust solution
>>
>>103490724
area is just number of islands
perimeter is how many times you attempt to go to a neighbor but that neighbor is out of bounds or a different color (plant type)
intuition is that every fence can be uniquely identified by a ((x1, y1), (x2, y2)) tuple that are the cells it sits between. here we have to double count as well for different colors but you can just add that to the tuple

t. >>103490565
>>
>>103490799
That code looks pretty elegant and concise to me. Surprised it works honestly.
>>
>>103490760
I just counted the number of 90deg corners and use that as my side count.
either you have (left/top) neighbor of different plant type, that is a 90deg outside corner.
or you have (left/top) same plant type but diagonal topleft different plant type. that is an inside corner.
and then just check the four directions (left/top - top/right - right/bot - bot/left) for these two cases.
>>
>>103490790
awesome. 10/10
>>
>>103490799
brainfuck or something? gib code
>>
>>103490810
yeah i figured there must be some way using corners
sounds pretty clean
>>
>>103490807
oof concerning
>>
>>103490774
my part 1 is 18942 too high. Any ideas? All examples work fine
>>
can someone post the bookmarklet for extra stats?
>>
>>103490565
for the stupid me. can you draw a picture of this? I am not getting it.
>>
>>103490718
Figured it out. I'm retarded.

I had a recursive solution to find the area with this manual "steps remaining' function set to 100, decreasing by one each recursive call. Works fine for small examples but breaks when areas are really big. What an idiot!
>>
>>103490774
Eric is gonna sue you.
>>
Can someone give me psudocode for p2
>>
>>103490774
Based, thanks anon, this helped a lot.
>>
Jesus Christ I finally got something working for part 2. That was a pain.
>>
>>103490846
loop rows
loop columns
if it is region, cell on top of it is not and you are not following a side already
increment side and toggle flag that you are following a side now
if it is not a region or cell on top is
toggle flag, because you stopped following a side
- same for bottom side of each row
- same, but switch rows and columns, instead of top and bottom left and right side
>>
>>103490846
why not just look at the multiple examples of actual code above?
in either case you're filtered
>>
idek why my part 2 works desu
>>
File: fences.png (109 KB, 998x1403)
109 KB
109 KB PNG
>>103490841
for the A region, arrows are all the fences, white ones are the ones that I counted
>>
>>103490865
That's cheating
>>
part 1 answer too high, fuckkkkkkkkkkkk
>>
https://scikit-image.org/docs/stable/api/skimage.segmentation.html#skimage.segmentation.watershed
>>
>>103490774
my shit golang
sum1 1573474
sum2 966476

real 0m0.141s
user 0m0.157s
sys 0m0.145s
>>
So Geohot is using LLMs for the leaderboard right?
>>
>>103490877
pseudocode is just the same
you're filtered regardless of which you look at
>>
>>103490883
https://geohot.github.io/blog/jekyll/update/2024/12/07/elon-swing-voter.html
>Sidenote, I’m in 7th place on Advent of Code thanks to AI
>>
File: day7gold.png (26 KB, 737x677)
26 KB
26 KB PNG
Around 4 hours. I can run this on hardware.
>>
>>103490887
KWAB. So the leaderboard tranny was actually fucking lying on LinkedIn.
>>
>>103490875
ah smort.
I see nou, you counted the 'right edge' of each fence side.
cool will remember that. ty for the nice drawing
>>
>>103490878
same. I don't get it.
It's not that hard is it?
>>
>>103490892
holy basedboy. nice
>>
>>103490899
wait till you see part 2
>>
File: carbon.png (2.93 MB, 1498x3276)
2.93 MB
2.93 MB PNG
Solution in racket. I could golf this more but I want to sleeep
>>
File: Untitled.png (29 KB, 1275x191)
29 KB
29 KB PNG
>28th place already has a delta of 1 hour
>>
>>103490878
>>103490899
>repasted my input again, it works this time
im gonna kms
>>
File: 1732327187241876.jpg (90 KB, 500x628)
90 KB
90 KB JPG
>>103490920
>not automating input fetching
>>
>>103490919
tomorrow will be a taller wall
>>
File: day12.png (24 KB, 424x345)
24 KB
24 KB PNG
>oh, part 2 is just corner checking
>fuck, I keep fucking up corner checking, surely my score will plummet
>my ranking goes way up between part 1 and part 2
??????????????
>>
>>103490919
>Only 28 solves after a hour
>>
>>103490932
You may have fucked it up, but the average person fucked it up way harder.
>>
>>103490919
kek that's me, I wasn't counting the concave corners properly and ended up rewriting everything
>>
Do a lot of you keep utilities and then just copy + paste? I feel like I should start doing that because I recognized what to do on this problem, I had already implemented in 2023 iirc, and I just spent time re-writing things I already did before.
>>
>>103490932
lol wtf is that image?
>>
File: cute_hg.gif (470 KB, 243x270)
470 KB
470 KB GIF
C++ 23
#include "aoc.h"
static const char* m;
static char* v;
static int z;
static int d[8];
static P<int> s;

static auto cost(char type, int start) {
struct {int per = 0, area = 0, sides = 0;} r;
int a[8];
s.push(start);
ɤ (s.ϟ) {
def idx = s.top(); s.pop();
if (v[idx] || m[idx] != type) continue;
v[idx] = true, ++r.area, r.per += 4;
ɤi (8) {
def nidx = idx + d[i];
def c = nidx < 0 || nidx >= z ? 0 : m[nidx];
a[i] = c;
if (c != type || i & 1) continue;
if (v[nidx]) r.per -= 2; else s.push(nidx);
}
ɤi (8) {
r.sides += a[i] != type && a[(i + 2) & 7] != type;
r.sides += a[i] == type && a[(i + 2) & 7] == type &&
a[(i + 1) & 7] != type;
++i;
}
}
return r;
}

int main(int argc, const char** argv) {
if (argc != 2) return puts("Missing file name"), 2;
MmFile in(argv[1]);
if (!in.α) return puts("Failed to read file"), 1;
const int w = (in | '\n').h.ω - in.α, w1 = w + 1; z = in.ω - in.α;
d[0] = 1, d[2] = w1, d[4] = -1, d[6] = -w1;
d[1] = 1 + w1, d[3] = w1 - 1, d[5] = -1 - w1, d[7] = -w1 + 1;
m = in.α;
V<char> vis(z); v = &*vis.α;
N silver = 0, gold = 0;
ɤi (z) {
if (v[i]) continue;
def type = m[i];
if (type < 'A' || type > 'Z') continue;
def [per, area, sides] = cost(type, i);
silver += per * area;
gold += area * sides;
}
$o silver, gold;
}
>>
>>103490952
I have macros for nested loops
>>
>>103490952
nope. I just retype all the shit each year.
>>
File: 1724827061565374.png (46 KB, 690x316)
46 KB
46 KB PNG
>mfw
>>
>>103490952
I probably should, but I don't. I've rewritten the same code for board traversal this year alone.

>>103490956
What is in aoc.h? Your sepples looks weird
>>
got filtered by part 2 ...........................
>>
>>103490956
I gotta go jerk off to illya now i'll do p2 later
>>
>>103490962
brutal
>>
>>103490970
see you next year
>>
>>103490899
got it. for some reason I allowed diagonal edges.
I guess I just cant read a simple problem description.
>>
>>103490970
This is what I did. Open a text editor. Use the AB example in part 2 (the one with two touching inner regions), triple the size of the grid with spaces, and draw fences around the region with your keyboard. What to do should come to you in about five minutes.
>>
>>103490988
cute
>>
>>103490971
She's 11
>>
>>103491000
11/10
>>
>>103491000
out of 10
>>
>>103491000
out of ten
>>
>part 2 correct on test
>wrong on input
NO NO NO NO NOOOOO NOT LIKE THIS
>>
>>103491004
>>103491005
>>103491007
techloli/g/y never disappoints
>>
>>103491000
/10
>>
>>103491000
Wrong, she is 18 in Fate Stay Night and 8 in Fate Zero.
>>
File: .png (1.49 MB, 1113x1385)
1.49 MB
1.49 MB PNG
Legitimately the worst thing I've ever fucking written that actually works
I doubt I could ever manage to do anything worse than this, there's nowhere left to dig that could take me any lower.
>>
>>103491000
if you wear clothes like that making those poses you'll get pregnant
>>
File: img-2024-12-12-07-56-02.png (1.47 MB, 5546x4882)
1.47 MB
1.47 MB PNG
idiomatic Rust solution
>>
I have edges but it doesn't count edges with a discontinuity like a W shape
Not sure I want to be bothered to solve it
>>
these deltas are just sad
>>
finally got it. confirmed retard.
>>
>>103491053
so you just have a bounding box?
>>
finally got it, had a harder time with p1 than p2 funnily enough. The code for p1 is pretty nice, but the one in p2 is dirty full of edge cases of corner counting but w/e. Mercifully the p2 examples provided all the corner (heh) cases so once it ran for all of them it ran for the input and it wasn't a frustration debug session
>>
>>103491071
yup. I think a lot of people are lucky he gave concave/convex corner examples.
examples with islands/holes and separate boxes but same plant type.
>>
>not counting interior holes
FUCK FUCK FUUUUUCK FUCK FUCK FUCK FUCK. SSEE YOU IN 2 MORE HOURS
>>
>>103491069
Using the example, I get the right answer for shapes like R but too low for C because of that hook around J
>>
>trace the edges of this ascii non-polygonal shape
I hate this more than I hated DP problems a few years ago.
>>
File: 1731305808606333.png (713 KB, 2560x4248)
713 KB
713 KB PNG
Somewhere along the way I swapped an index and it took me 45 minutes to debug for p2. This code is probably horribly inefficient. I first did a flood fill to find the areas and then went back and counted perim/edges. I'd imagine maybe theres a way to do it in one pass.
>>
File: IMG_20241212_090743459.jpg (419 KB, 1536x2040)
419 KB
419 KB JPG
thinking paper
>>
File: horrible aoc 2024 12.png (132 KB, 1197x676)
132 KB
132 KB PNG
horrible solution today
>>
>>103491124
now imagine a spinning apple in your head
>>
File: carbon.png (263 KB, 916x1479)
263 KB
263 KB PNG
>>103490720
Washed

>>103490846
For part 1 I flood filled until every tile had a unique plot ID, then looked at every tile and counted a fence segment for every adjacent coordinate that did not have the same ID.

For part 2 I copied all my code for part 1, but instead of just counting the segments, I stored them (unique plot ID + 'owner' tile coordinate + offset of the adjacent coordinate that warranted a fence segment as direction) in an 'ungrouped' pile. In a second pass I did another tiny flood fill/BFS on a random fence segment in the ungrouped pile, looking for 'connectable' segments (same plot ID, same direction, coordinate +/- 90 degrees of direction), removing adjacent segments until the BFS dead ended, and then restarting the flood fill with another random segment until the ungrouped pile was empty.
>>
File: 1733987699103.jpg (3.35 MB, 4000x3000)
3.35 MB
3.35 MB JPG
>>103491124
Im about to throw out my entire solution because I didn't consider holes in the shape.
>>
>>103491131
havnt seen the spraypaint can since to 2000's. nice
>>
was it possible to do the plot discovery and the perimter/edges in a single pass?
>>
>>103491143
just keep at it. you will be able to do it.

You can also consider just printing your input file and manually count the area/sides.
>>
>>103491153
sure
>>103490810
while you are dfs an area, for each point you can add this check.
at the end you will have the area/fence length and side count
>>
>>103491180
Everything can be done in a single pass.
>>
>>103490767
Sorry, didn't check the thread while for a while.
They are generated with Bing Image Creator. Prompt in picrel.
>>
File: 2024_12_zig.png (29 KB, 696x1091)
29 KB
29 KB PNG
Washed Zig solution, takes 50ms some optimization will make it a bit less readable though.
>>
File: day12-mathematica.png (82 KB, 1275x973)
82 KB
82 KB PNG
Thank you Wolfram! Unwashed, despite being built-in, it was a bit of an effort to work out how to make it do what I needed.
>>
File: smart.png (537 KB, 1280x2555)
537 KB
537 KB PNG
I can't believe this shit worked what the fuck
>>
What times are you all getting, are you ready for the BIG BOY?
>>
File: 1673160126392429.png (519 KB, 720x720)
519 KB
519 KB PNG
>>103491036
>key=lambda x: (x[ks//2],x[ks//2-1])
>>
>>103491203
ah. Thanks for showing. At least that style looks better than the normal AI slop. And the scenes are interesting.
Make some more.
>>
File: carbon.png (2.78 MB, 1446x3686)
2.78 MB
2.78 MB PNG
>>103490749
I washed my ass but I'm not sure if it's as readable as I'd like
>>
File: day12.png (202 KB, 799x1528)
202 KB
202 KB PNG
>>103491232
1.6 ms using union find.
day12
1381056 834828
took 1612 ÎĽs (aoc_2024::day12::solve)
>>
>>103491259
Cool, I learned something today.
>>
File: shoot_2024-12-12_02:36:07.png (1.03 MB, 1425x6609)
1.03 MB
1.03 MB PNG
I FUCKING DID IT BROS I FUCKING DID IT

part A was easy with floodfill

Then for B. I first tried to walk along the edge of the shape. This worked perfectly, except for the fact that walking along the edge MISSES INTERIOR HOLES.
So my new strategy was to make a list of all the edges for each square in a reigon, then iterate removing all connected edges from that list and incrementing wall count by one.

Now that I have solved it, what is the non-retarded way to detect edges. I was trying to draw lines through the shapes and count intersections or some other topological bullshit like that, but I gave up.

Oh and my code is very unwashed, with several abandoned and unused functions from earlier

ALSO IF YOU LOOKED AT THE THREAD AND CHEATED YOU FUCKING DISGUST ME AND I HOPE YOU DIE
>>
>>103491265
I did part 2 in the same flood fill just counting the fence if there wasn't a fence on top or left depending on the direction.
>>
>>103491265
what's your delta
>>
File: 1709703755053361.jpg (251 KB, 1024x1024)
251 KB
251 KB JPG
>>103491241
>normal AI slop
Rude!
>>
>>103491272
2 hours 11 mins
>>
>>103491265
I did the same as you for edge detection. I start with the set of all edges, and follow one continuously until I can't follow it any longer. Then I remove all the continuous edges from that set and continue until none are left. This bullshit: >>103491231

Seems like the "smart" way to do it is to identify corners, since num continuous edges will equal num corners. Still not exactly sure how to implement that though, especially when dealing with interior cutouts.
>>
File: xarbon.png (35 KB, 644x1572)
35 KB
35 KB PNG
unwashed ass
I should kill myself.
      -------Part 1--------   -------Part 2--------
Day Time Rank Score Time Rank Score
12 00:09:16 648 0 02:35:17 5258 0
>>
>>103491180
what I did is: if a cell has no walls (or only 1 wall) check the diagonals and if they are different types it's a corner. In the wall case, the diagonals to check are only the opposites of the wall.
>>
>>103491265
count corners.
there are 2 checks, concave,convex corner on all 4 sides of a tile.
>>
>>103491259
      --------Part 1--------   --------Part 2--------
Day Time Rank Score Time Rank Score
12 02:12:21 10025 0 02:29:29 5124 0

started late. over-engineered part1 as usual, so part2 was no headache. feelsgood

>>103491282
thats exactly how I did part2
>>
>>103491282
easy, check if up and right are both not the same as the plot you are in for outside corner, check if up and right are the same as the plot you are in but the diagonal one is not the same as the plot you are in for inside corner. Do all four corners for each case
>>
fucking finally

now time to optimize with claude
>>
>>103491274
ok. that is also cute.
But the art style between the character and the background is a bit disjointed.
The bingAI has a consistent style to the whole image.
>>
File: 1732527924865646.jpg (233 KB, 1024x1024)
233 KB
233 KB JPG
>>
>>103491061
Screenshot of deltas?
>>
>>103491278
o7
>>
I bet people will pretend this question wasn't hard, even though the top 100 to get both stars ALL TOOK longer than 6 minutes. It took like 4x longer than any other question.
>>
File: Untitled.png (155 KB, 1375x743)
155 KB
155 KB PNG
>>103491311
>>
>>103491271
FUCK YOU'RE RIGHT AAAAAA I SHOULD HAVE SEEN THAT. I don't get that edge case of not counting the fences though, wouldn't you just always count the fence.
>>103491282
>>103491299
>Identify corners
I was trying to do somehting semi-related with the relative edge-counts of each cell, but I couldn't figure it out.
>>
>>103491322
give it from the start, i want to see where i rank for today
>>
QUESTION:
Does 0 size plots have area, fence length or num border counts?
>>
>>103491327
there cannot exist 0 size plots, retard
>>
>>103491324
see here
>>103490810
thats the check I used.
>>
>>103491324
You can see that I only count the first fences in my solution >>103490733
>>
>>103491320
llm bros btfo
>>
>>103491339
my memory stores 0 size plots though
>>
sigh. my mouse just broke. Cant trigger the wheel freespin now.
>>
File: carbon (2).png (356 KB, 1834x1676)
356 KB
356 KB PNG
did any one else just [spoiler] inflate the grid [spoiler/]?
>>
>>103491350
then you're simply not adding the single plot your search is encountering, dumbass
>>
>>103491327
0 sized plot has no area so multiplying the amount of fences or borders with it just results in 0 and they can be safely ignored
>>
>>103491346
Oh I get it now, yeah this method is way better that corner counting or the retarded brute force edge counting i'm doing, especially as I am already doing the flood fill. Thanks anon.

If I ever wash my ass I will do that, but I think I am going to go to sleep and never look at this problem again.
>>
>>103491357
But do we have to account for it in our final sum answer?
>>
>>103491356
Yes, sadly >>103491287
>>
>>103491366
yes, adding 0 many times is a staple of advent of code.
>>
File: dob.jpg (96 KB, 1090x1280)
96 KB
96 KB JPG
>>103491356
>>103491371
Sounds interesting. can I get a QRD on what inflating the grid means and what problems it solves? I don't feel like deciphering your code.
>>
How do I make a corner counting algorithm that handles both of these cases (without just tracing the edge)

.AAA.
.AAA.
..AA.


.AAA.
.A.A.
..AA.
>>
>>103491405
>Follow advice of anons on /g/ without truly understanding why you are doing it
You disgust me. Plus you are filtered.
>>
>>103491411
I already finished, I'm just trying to figure out a more elegant solution since mine is quite verbose
>>
>>103491420
carry on then, my mistake. I don't know myself, my broot solution based on what i've seen in the thread would be to iterate through every square, and check for all 8 corner types.
>>
>>103491405
did you read any of the previous comments? there is like 5/6 different comments that should help you.
>>
>>103491405
Can anyone confirm if the amount of verts for A in the second example is 15?
>>
explain yourself
>>
>>103491486
>roblocks oof sound
>>
>>103491486
>>103491499
> https://youtu.be/ye0xG_QUI0A
>>
>>103491486
He's solving 10 and 11 on pen and paper
>>
>>103491518
>>103491526
I saw what you deleted
>>
>>103491526
>>103491531
same. Its still loaded on my screen. What a fumble.
>>
>>103491531
My fault for clicking on the wrong post to reply I will now commit seppuku
>>
>>103491539
*sudoku
https://sudokupad.app/oaeuopmvrt
>>
What do we figure the death toll will be for today. At least 10 from the /g/ leaderboard. Maybe even enough for us to dip below 100 unfiltered anons.
>>
>>103491539
self filtering. sad
>>
>>103491543
too complicated
>>
File: 1714177130340677.png (2.37 MB, 1190x2700)
2.37 MB
2.37 MB PNG
much better now
>>
>>103491545
Everyone below 10 stars
>>
Today's O(n*m) is so fucking trivial I won't even implement it.
>>
I FUCKING FINISHED P2
>>
>>103491613
>I finished it in my mind
>ok, whats the answer?
>you dont understand, I am NOT doing it because it is too easy
sure buddy
>>
>>103491613
This is bait
>>
I just reused the same floodfill code as regions for edges
>>
Holy fuck, switching to an arena allocator made my Zig code 5x quicker. I am pretty satisfied with 13ms on my shitty laptop.
>>
>>103491619
nice!
>>
>>103491619
Post it
>>
>>103491632
>>103491635
I did finish and realized it's already O(n*m).
I just hate hashmaps, so I should probably remove those.
>>
File: zig.png (1.09 MB, 1870x3583)
1.09 MB
1.09 MB PNG
I'm not filtered on part 2 but just look at this shit. simplify() is taking known-border points and trying to expand them into rectangle walls with easy to count sides and it's the wrong idea done badly. I hate tracing ascii polygons. If mapping each char to a 9x9 char doesn't trivialize it like it did the last polygon-tracing problem, I'm skipping the day.
>>
File: 1712122919005749.png (784 KB, 1934x2577)
784 KB
784 KB PNG
Getting VERY bored of this grid shit.
>>
>>103491356
I considered that because it was also the easiest way to handle day 10 last year
https://adventofcode.com/2023/day/10
but figured it was designed with that in mind and would fuck you over with some annoying edge cases if you tried that, which turned out to be kinda true in part 2
>Be especially careful when counting the fence around regions like the one full of type A plants; in particular, each section of fence has an in-side and an out-side, so the fence does not connect across the middle of the region (where the two B regions touch diagonally).
>>
>>103491649
>If mapping each char to a 9x9 char doesn't trivialize it like it did the last polygon-tracing problem
How does this help
>>
(((modern business practices)))
>>
>>103491649
>I'm not filtered by part 2
>Proceeds to explain why you're filtered by part 2
>>
File: im-done.gif (2.62 MB, 354x266)
2.62 MB
2.62 MB GIF
https://pastebin.com/2bfRRKNV
it's done, it's over
I am actually extremely happy with this, I don't care if it's horrendous spaghetti. it works and that's what I care about. I managed to solve this on my own. Shoutouts to the palvidis algorithm, recursion, and caching.
Part 1 was "brute forced" with some recursion, and while going through part 2 I realized I could just reuse my area code from part 1 so all part 2 had to focus on was the perimeters. Fortunately, all of the examples given in the part 2 description contained all possible edge cases for me
>>
>>103491667
has day 13 dropped yet for you?
have I cheated yet?
is this enough uses of "yet" for you?
>>
File: 2024_12_zig_faster.png (24 KB, 682x979)
24 KB
24 KB PNG
>>103491649
Compare with my Zig solution if you'd like.
>>
>>103491677
>palvidis algorithm
>look it up
>I derived it from first principles today
Does the real algorithm have a fix for holes in the shape. I had to abandon it because of that.
>>
>>103491652
oh jesus. I missed that and just assumed its not connected.
>>
>>103491679
>have I cheated yet?
Yes, as you are in this thread before solving.
>>
if both parts take you longer than 1 hour, you are filtered
simple as
>>
>>103491716
> lets do these fun daily programming puzzles this eric guy made
> oh btw, I am making up my own rules for this

nice logic
>>
>>103491716
rip
      --------Part 1--------   --------Part 2--------
Day Time Rank Score Time Rank Score
12 00:42:23 4801 0 01:03:20 2067 0
>>
File: img-2024-12-12-09-54-43.png (2.16 MB, 9848x4120)
2.16 MB
2.16 MB PNG
today wasn't even hard
>>
>>103491730
Post times nigger
>>
>>103491690
It doesn't, it was only solved because I integrated it with my part 1 solution. Essentially, for part 1 when I'm checking every plot, if a plot is bordering a plot that is not of it's own type, I store it in an array. Then, when I go back to iterating over plots, I run palvidis on every plot for that region that was bordering one not of it's own type. Within my palvidis I'm also caching each time I perform a check, so that after I run it on the outside of the shape once, the next part of the shape is already cached and it skips over it until it reaches a plot that is touching a direction other than the outside of the shape. The reason this was done is that I was imagining this edge case:

OOOOOOO
OXXXXXO
OXOOOXO
OXOOOXO
OXOOOXO
OXXXXXO
OOOOOOO

and in this case if you said "I already ran on this plot, don't try palvidis again" then it would fail, because there are situations where the outer ring might be touching an inner ring. I don't know if that explanation made sense, but it was a lot of data storage
>>
>>103491730
meh today was 'easy' in the sense that I knew what to do. I just type slow.
>>
>>103491716
If first part takes you more than 10 minutes, you're filtered.
>>
>>103491744
I could have got #1 on the leaderboard, but I just have other things to do. I have a life, and you know, just sorta take a casual approach. I mean, I cannot believe you guys are still doing this...
>>
bigboy for today?
>>
File: day12clojure.png (1.8 MB, 1023x1200)
1.8 MB
1.8 MB PNG
I did some cursed stuff for this one.
I guess the flood partition fn goes into my utils for later.
>>
took me a retardly long time to finish but still not filtered
>>
>>103491804
>>103491716
>>
File deleted.
Garden visual. 26 different plant varieties.
>>
>>103491716
nigger p2 isn't possible in under a hour
>>
>>103491810
>>103491730
>>
>>103491804
>>103491806
>>103491716
>>103491757
You're filtered.
>>
>>103491810
using verbose golang
>>103490746
>>
>>103491821
>more than 10 minutes for part 1
filtered
>>
>>103491809
Ugh, I didn't expect it to resize like that.
>>
>people are actually tracing the contour, arguing about corners, expanding the grid and a bunch of other shit
but why
Just extract all the left-facing edges and deduplicate neighbors.
Then do the same for right-facing, up-facing, and down-facing ones.
Then you're done.
>>
You're filtered.
No, I didn't reply to anyone. I mean YOU. The person reading this.
You were filtered today. It doesn't matter if you solved it or how long it took you.
Please remove yourself from the /g/ leaderboards, because you were filtered today.
Thank you for your patience and understanding.
>>
>>103491827
shit sorry
>>
>>103491836
damn its over
>>
File: Untitled.png (3 KB, 384x31)
3 KB
3 KB PNG
over 50% still stuck on p1
>>
>>103491836
I stopped reading after "You're fil"
So no, I am not yet filtered.
>>
File: gardens.png (23 KB, 980x980)
23 KB
23 KB PNG
>>103491809
>>
>>103491716
You're filtered.
>>103491757
You're filtered.
>>103491764
You're filtered.
>>103491804
You're filtered.
>>103491821
You're filtered.
>>103491836
You're filtered.
>>103491850
You're filtered.
>>
>>103491854
nice looks better
>>
>>103491836
jokes on you, i dont read
>>
Question:
Do you like that the overview has the day in sequential order? Or like 2023 where the days are in a random position?
>>
>>103491866
sequential order
>>
>>103491866
sequential is way better
>>
>>103491866
depends on what we're doing
I think it's really cute when the graphic follows our journey (diving in eric's oceangate sub, then getting spat out as mincemeat, for example)
>>
New thread
>>103491900
>>103491900
>>103491900
>>103491900
>>
>>103491866
absolutely sequential
>>
>>103491866
I think its cool in the cases where you visit random locations in the map throughout the 1-25days.
But looking back its just annoying trying to find the day you are looking for.
>>
>>103491866
Nonsequential is really annoying when you're going back through an old year and looking for some specific puzzle
>>
>>103491401
double the size of each point/upscale the grid by a factor of 2
doing that helps avoid a ton of annoying edge cases when finding corners
>>
I should start waking up at 6am to do the puzzles, another free win for bruteforcelords
>>
>>103491664

based
>>
>>103491651

never apply to google then



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.