[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [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

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: ec.png (190 KB, 1160x1184)
190 KB PNG
>Everybody Codes is a free space for honing your coding skills, experimenting with ideas, and learning from others. At its heart lies the belief that programming is best when shared - whether through solving puzzles, streaming your progress, or discussing solutions.

https://everybody.codes

Similar to Advent of Code, but the month long event is in November, and smaller three day long events open spontaneously through the year.
There will be a three day long event in 12 hours from this post.
Each day has a programming puzzle with three parts to it.

>/g/derboard code
4151e976-7b9f-4fda-bb33-fa7c70fdceea

>Previous thread
>>110244644
>>
nobody codes
>>
>>110340109
I tried the advent a few times and i made some progress but I thought it was utterly boring.
>>
File: img-2026-11-15-15-18-23.png (165 KB, 1310x1818)
165 KB PNG
>>
File: stats.png (34 KB, 940x600)
34 KB PNG
>>
>>110340581
>it was utterly boring
Filtered
>>
Is nobody still doing this?
>>
>>110344936
Next puzzle opens in a little under 25 hours, everyone who isn't filtered is just resting until there's more to solve.
>>
File: stats.png (36 KB, 940x600)
36 KB PNG
>>
>>110347664
>just by being unfiltered you're in the top ~15% of people who stuck around for at least all three parts of day 1
Grim.
>>
File: 1733801519961953.png (59 KB, 478x360)
59 KB PNG
>>110340109
is this worth it or should I wait for scuffed 50% reduced advent of code from maybe phoned-in eric in december
t. done advent of code every year since 2021 but never other events
>>
>>110348914
everybody codes is better than twelve-days advent of code in my honest opinion
the story is less fun and sometimes the problems aren't super interesting, but each one at least tries to have a twist beyond being a generic leetcode and it stays interesting enough that I like playing
if you can complete advent of code years without being filtered then you should try everybody codes 2026 day 15 (the most recently released puzzle at time of writing) and roughly judge the quality of the event from that
>>
>>110349024
okk might look into it when I wake up too sleepy now
>>
up
>>
>>110340109
>OAuth2
Fuck off.
>>
>>110351617
>Filtered by an inability to create a burner Github
>>
5 MINUTES
>>
>part 2 is "now do it a million times"
>brooted it in a minute
>part 3 is "now do it a million billion times"
>no progress happening at all
hope this isn't slam shuffle 2
>>
>>110353610
update: part 3 broot time estimation is now 1387 hours
>>
There's probably a few ways to solve today.

Spoilers ahead:

For me, it was realizing only a very small section of a flip isn't flipped again next time, so you only need to record the small "permanent" section for each step.
I ended up just using two pointers on a string, stopping when they both reach each other in the middle. Repeat for sorting each shade.
Solves Part 3 in 800ms, solves a hypothetical Part 4 where the input is repeated one thousand times in 8s.
>>
>code is so cursed that pycharm has locked up and needed forcekilling like 5 separate times now
>>
>>110354872
I did pretty much the same thing.
I did consider a sort of doubly linked list with annotations on each link whether the rest of the list should be considered flipped from now on, but thankfully I thought better because that would have been way more fiddly and much more general than needed.
You could actually probably use an xor linked list, with no further annotations. Would need to be very careful with how you update the xors, though.
>>
pretty cool, something that is not cycle detection and also understandable.
since sorting every shade had nested flips, I just calculated the final positions starting from the outermost flip.
>>
File: carbon.png (369 KB, 1024x2300)
369 KB PNG
Holy fuck that was annoying.

Behold my polished turd where I torture a linked list to death. I thought of at least two alternate ways to solve it but after the fifth hour or whatever I was too invested to switch.

>>110355058
Updating pycharm fixed the bullshit, thankfully. It really didn't help that it also rolled back my script a bit after every single force-kill, and I kept forgetting wtf I was doing because of it.
>>
File: 1785454515027014.png (246 KB, 630x626)
246 KB PNG
so I know how to ungabunga 16#1 but it is my first day and if it is anything like (lategame) aoc you are punished for ungabunga on later parts
>>
>>110341831
Where's leijurv
>>
File: leijurv.png (1.55 MB, 1438x809)
1.55 MB PNG
>>110356038
He did a celebratory toenail ripping after aoc 24, but he accidentally ripped too much.
>>
File: 16.png (276 KB, 1673x2174)
276 KB PNG
idiomatic Rust solution
>>
my cpu is flipping
>>
>>110356397
part2 with part3 input took 15 minutes
I AM BROOTING
>>
Did anyone recover the easter egg?
>>
>>110356470
wait a minute that was just part1, this is not going to work
>>
>>110356391
this isn't idiomatic enough, I can actually read it today
>>
File: Part 3 Visualization.png (59 KB, 1000x100)
59 KB PNG
>>110356473
Doesn't look like there's anything hidden in my Part 3...
>>
File: hidden.png (197 KB, 679x728)
197 KB PNG
>>110356609
There's some hint here, but I tried a few things and couldn't get it. I'll search for it later today.
>>
>>110340109
>https://everybody.codes
oh sick I love making troll code on these. I never do that anymore, my big int solution on code wars is hillarious.
>>
File: 1679590039951941.jpg (65 KB, 679x1024)
65 KB JPG
ok yeah I dont think I will be brooting part 3
>>
File: broot16.webm (1004 KB, 555x442)
1004 KB
1004 KB WEBM
>>110356819
my biggest group in the broot is currently like 5 million (so one of the shades has 5 million isolated islands sections books of that shade)
the biggest group is decreasing at a speed of like uhhh 2000-2200 per minute
so according to my calculations my broot will take somewhere between 30-50 hours to finish

but it might actually speed up as it goes since I have a few optimizations unless I FUCKED THOSE UP BAD in which case

>left column is largest number of merges left to do
>right column is the cumulative flipcount

by the time I finished writing this post it says 4995291
>>
File: 1776717965897528.png (193 KB, 431x412)
193 KB PNG
>>110357043
ok I made the tiniest optimization and my new broot estimate is around 20-30 hours
it is doing 3200 per minute instead of the earlier 2200
>>
File: file.png (46 KB, 787x303)
46 KB PNG
>>110357117
My input had 6 million flips (oy vey) so that sounds about right.
However if you're brooting, the length of the segments you have to flip trends towards zero, so the average length is really (10m/2 + 7.5m/2 + 5m/2 + 2.5m/2) / 4 = ~3.125, so if you're doing 3200 per minute at the start, you should expect to do an average of about 10000 per minute across the whole puzzle, which means for 6.3 million flips should finish in around 10.5 hours instead of the expected 20-30! And that means if you've left your broot running since you made this post, you should finish an hour or two before the next puzzle, therefore dodging the filter!
I believe in you brootchad!
>>
File: groupsize.png (142 KB, 1025x709)
142 KB PNG
>>110357587
I stopped and restarted the broot a while back since it was just running for a short while to cash in on my improvements
my quick mental maths said the improved version would catch up at some point

I print every 1000 flips
it might not finish in time but if it works it will be funny enough to be worth it
>>
File: ec16.png (456 KB, 1280x3995)
456 KB PNG
>>110357674
time to sleep now
I probably messed up some optimization because it going at about sthe same pace as earlier
if I brooted it with <id,length> tuples instead of a huge array of the actual ints I would probably get big speedups from not having to scan backwards and forwards for the start and end of segments all the time
but too sleepy to make that fix now

4519420 merges to go at around 50-60 a second is 20 hours
hopefully it speeds up
>>
>>110358226
bro, my 10 line unoptimized brute force on a 10 year old chinkpad is like 10 times faster than your shit.
>>
File: l.png (180 KB, 1278x1976)
180 KB PNG
>>
>>110356819
Pair programming with this girl.
>>
I'd like an easy day, so I can go back and clean up/optimize my Q15 and Q16.
>>
5 MINUTES
>>
File: 1779486824782483.png (532 KB, 638x458)
532 KB PNG
>>
File: 16broot.png (49 KB, 1001x306)
49 KB PNG
>>110358226
>your length is correct but your first character is incorrect
rip
6 hour broot though

>>110358575
I am not very clever ok
>>
Was anyone's Part 1 useful to them for the next two parts? I just completely started over and never reused any code. Was Part 1 only there to show you the concept of a grid?
>>
File: carbon (1).png (276 KB, 826x1779)
276 KB PNG
>>110362755
For part 1 I manually constructed a dict of neighbors for each point so I could just feed it into the generic bfs function in my AoC/EC library.
Then for part 2 I copy/pasted that neighbor dict constructor code and just tweaked it slightly (toss out the dict, swap in an accumulator) to get the answer.
Then for part 3 I copy/pasted and tweaked that same chunk of code again, again to do something completely different. This time it was for filling in intermediate walls after blowing up the grid by a factor of 2, so I could run a wall-following turtle on it.
>>
File: file.png (40 KB, 593x1443)
40 KB PNG
>>110363032
example input with verbose mode on
>>
If you actually stepped along a edges in parts 2 or 3, you should rethink your approach.
>>
File: 17.png (676 KB, 2216x3662)
676 KB PNG
idiomatic Rust solution
>>
File: l.png (180 KB, 1276x1976)
180 KB PNG
>>
>instead of solving the problem get distracted tweaking my utils in preparation for aoc
oh well filtered today too
>>
>>110363780
Why? Part 3 gets solved in 4 ms
>>
I'm scared.
>>
>>110370339
The Great Filter Cometh
>>
Fuck
>>
Brute bros...
>>
>>110370389
Nevermind it's easy.
>>
>>110370592
I was lucky today that I could spot what P3 would be once I had P1 working.
>>
both today and yesterday, i solved part 3 by adding one line to my part 2
>>
File: 18.png (241 KB, 2156x1598)
241 KB PNG
idiomatic Rust solution
>>
File: 1776152796411117.png (6 KB, 703x73)
6 KB PNG
Come on 726995, you can solve Day 9 Part 3, it's not that bad.
>>
>expected Q17 part 3 to be dp but it was just dfs.
>expected Q18 part 3 to be the 3d version of part 1, but it was a bigger part 2 that can still be solved in O(N^2).
Duckbros...
>>
>>110372578
stop whining and redo part 3 so it solves in O(n)
>>
>>110372356
I am waiting for the code to finish running. Anytime now...
>>
wasn't expecting today to be so easy
nice
>>
>O(N^2) when an O(N) solution exists
filtered
>>
5 MINUTES
>>
Nice and easy day again. I was prepared for some nasty rotating trampoline problem.
>>
Where are the hard problems?
Part 3 had too many restrictions, I figured out the trick too easily.
>>
File: q19p3.png (40 KB, 512x328)
40 KB PNG
Scaled 2x
>>
>>110379029
Maybe the puzzle creator ran out of ideas. I think last year there was a team, and now it's a solo project.
>>
>>110379165
would explain the number of cycle detections
>>
>I closed my eyes and used my new powers to explore every possible future at once, trying all three colours at each successive square and comparing the results of every complete arrangement. No combination could be left unchecked.
reminder that if you didn't broot it you are not lore accurate and your solution is non-canonical.
>>
CCMM
YYKK

my part 3 fails this example but succeeds the real input
>>
>>110380872
If the average of C,M,Y >= K, you can't just use the average of C,M,Y for all 3 factors, you need C+M+Y / 2 as 2 of the factors and then K as the third.
That one tiny input is basically specially crafted to be annoying because that case doesn't come up in any of the other examples or the real input.
>>
>>110380921
>C,M,Y >= K
fuck, obviously I meant C,M,Y <= K
>>
>>110380921
>>110380935
CCCCC
CCCCC
CMMYY

now solve this one
>>
>>110381309
120
>>
>>110381309
>>110381323
I get 125, though.
>>
>>110381458
I get 125 on my hacky math shortcut solver too, but I also wrote a generalized solver using z3 and it says 120. Although it sucks balls and only works on extremely small inputs like that one, I don't think I've even gotten it to finish on the big example input.
>>
>>110381516
weird, I get this as the solution:
 
CCMMM
CCYYY
CCCCC


which gives
CCBBB
CCGGG
CBBGG


thus, 5*5*5=125.

Kind of weird the solver got it wrong. Unless I misunderstood something.
>>
>>110381627
(I assume) the real inputs always have the best three colors be R, G, and B, I think >>110381323 and >>110381516 forgot about the rule that you can overlap C and C to get C.

so is there any input where the quantity of K is irrelevant and the best three colors are different values? or will the overlap rule allow for the best three colors to always be the average of C, M, and Y?
>>
>>110380921
>>110380935
>>110381627
CCC
MMY
MMY
KKY

what about this one?
>>
File: 19.png (360 KB, 1913x2222)
360 KB PNG
idiomatic Rust solution
>>
>>110382194
I get 50
>>110381839
If you mean all the inputs from Part 3, then I am too lazy to check kek, so no idea. Overall I just consider two cases:
- K is part of the answer: transform C,M,Y into two numbers, which are equal to (C+M+Y)/2. If the sum is odd, then add +1 to the second number. Multiply those two numbers with K.
- K isn't part of the answer: transform C,M,Y into three numbers that are as close as possible to their average, which is (C+M+Y)/3. If the sum is not divisible by 3, then add +1 to "(C+M+Y)%3" numbers. Multiply those three numbers.

I realized that each C,M,Y could "donate" to each other while the value of K can't change. So, I reduced this problem to: given 4 numbers, choose 3 numbers that have the maximum product, following two conditions: you can choose two numbers and add and substract 1 from them (so 10,3 becomes 9,4 or 11,2) and you can't choose the last number (which is K), so it can't be modified.
>>
>>110382227
doesn't solve part 3 >>110380872 or >>110382194 correctly
try again

>>110382315
>K is part of the answer
>K isn't part of the answer
it sounds like you compute both answers then return the max, but I wonder, is there a way to know which one to use without computing both?
something like, if K is greater than the CMY average divided by 6, use K and the CMY average divided by 2, otherwise just use the CMY average divided by 3.
>>
>>110382354
Solving the examples isn't required.
>>
File: gptfacewhen.jpg (9 KB, 177x200)
9 KB JPG
snailcats, why are you wasting your time on this?

do you like being unemployed, weak and inoffensive?
>>
>>110382354
>it sounds like you compute both answers then return the max
yeah, you are right. I forgot to say that. Since I don't know which case is the right one, I compute them both and choose the max of them.
>is there a way to know which one to use without computing both?
well, I computed both because each case is O(1). As for the actual formula, if K is part of the answer, then this holds, assuming S=C+M+Y:
(S/2) * (S/2) * K >= (S/3) * (S/3) * (S/3)
(S^2 * K) / 4 >= (S^3) / 27
K >= (4*S^3)/(27 * S^2)
K >= (4*S)/27


For this example: >>110382194
K=2, S=10
2 >= 4*10/27
2 >= 1.481...

since that is true, then taking K is the correct answer. This would imply that if K=1 or K=0, then the answer is not to take K. So, if we changed K to be 1 instead of 2:
C=3
M=4
Y=3
K=1

so, if we take K, then the answer is: 5*5*1=25
if we don't take K, then the answer is: 3*4*3=36.
So, the answer is not to take K (formula is correct).

For this example: >>110381309
K=0, S=15
0 >= 4*15/27
0 >= 2.222...

since that is not true, then taking K is not the correct answer. Although, this would imply that K has to be at least 3. So, for this one, if K=3 instead of K=0:
C=11
M=2
Y=2
K=3

so, if we take K, then the answer is: 8*7*3=168
if we don't take K, then the answer is: 5*5*5=125
So, the answer is to take K (formula is correct)

If K=2 instead of K=3, then:
if we take K, then the answer is: 8*7*2 = 112.
If we don't take K, then the answer is: 5*5*5=125.
So, the answer is not to take K (formula is also correct)

I am not sure if the formula is truly correct because S isn't always divisible by 2 or 3 and since there can't be decimals in any answer, then there might be some slight variations. For instance, if S=15, then 15/2*15/2 = 7.5*7.5 = 56.25, but we can't have decimals, so the true value would be 7*8 = 56. No idea if that extra 0.25 (in this case) that the formula doesn't take care of will make it fail.
>>
File: 19.png (428 KB, 2237x2654)
428 KB PNG
idiomatic Rust solution (also works for the examples)
>>
>>110382566
I ran a small brute that checks every value of c, m, y, and k between 0 and 10 and brutes the maximum score (checking every permutation of final values).
I was also testing ratio values to choose between multiply methods (take average and divide by 3, or take average and divide by 2 then multiply by black value) and was wondering why the special ratio value seemed to be 6.75, but your math explains it (27 divided by 4).
it looks like to generalize any part 3 input, all you need is:
sum = c + m + y
ratio = sum / 6.75
if k > ratio
return floor(sum / 2) * ceil(sum / 2) * k
else
return floor(sum / 3) * round(sum / 3) * ceil(sum / 3)
>>
File: duck.png (608 KB, 768x768)
608 KB PNG
>>
>>110382885
>>110379120
cool ducks
>>
File: duck.png (609 KB, 1202x1894)
609 KB PNG
>>
up
>>
Final day. It's going to be an absolute monster, most won't even finish before AoC starts. Book 10 days for this, minimum.
>>
5 minutes faggots.
>>
https://youtu.be/hjGZLnja1o8
>>
The wall is here. YOU will not pass.
>>
P3 is for the BRUTE CHADS.
>>
this was fun, brute all the way
>>
While you solved glorified leetcode claude solved the riemann hypothesis, brootal
>>
>>110390003
as long as we all had fun
>>
>>110355935
>the x is load bearing
>load bearing
AI slop
>>
solved but I had it easy because my language has base conversion functions by default
>>
Haha that was fun Oh man we have to wait all weekend again. Can't wait for Monday's!
>>
>>110390108
Which language?
>>
>>110390239
Who wants to tell him?

It's not too long, AoC starts Dec 1.
>>
>>110390242
JavaScript
console.log(parseInt("A86", 11)); //1304
console.log((1304).toString(11)); //"a86"
>>
File: carbon (2).png (399 KB, 898x3213)
399 KB PNG
That was a silly one. Luckily I didn't fuck up any of my tables, or even have to do any real debugging today.

Came in 4th or so on the /g/derboard, not too horrible.

See you lads in a week and a half!

>>110390036
>anon doesn't like my joke
>>
>>110390003
Yeah well, I beat Dario in EC, so...
>>
>>110390343
># '4': ['11']
I didn't even think about that

>eval
Anon.. Can you solve this equation?
rm -rf = 3 + 2
>>
File: file.png (45 KB, 921x335)
45 KB PNG
>>110390409
>>
>>110390549
Based. Winchads can't stop winning.
>>
how much more difficult would the problem be if you could move around as many matchsticks as you wanted (but you had to use them all)?
>>
>>110390995
More importantly than that, my script just crashes if any character outside of "0123456789-=+A " is in the input, before it hits any eval()s.
That wasn't intentional when I wrote it, but when I did a quick cleaning pass I did consider rearranging the segment count calculation to happen after determining if a line is valid, for a vanishingly small runtime improvement, but I realized that would also remove the implicit input sanitization, so I left it as-is.

I'm really curious if anyone can think of a way to inject malicious code with only the characters
>"0123456789-=+A "
>>
>>110391425
from ast import literal_eval
>>
>>110391429
oh nvm you are doing actual expressions
>>
>>110391384
The smallest possible equation that follows the format of the other parts is
1 - 1 = 1 - 1

with 12 segments.

By my count, there are 35753 possible permutations that can be made with 12 segments, but only a few could be considered valid equations, and it depends on your definition.
1 + 2 = 3 - 0
1 + 2 = 3
1 = 1 = 1
1 + 2
3++

How many of these would count as valid equations?
With just 14 segments there are 227813 possible permutations, and I get an OoM error when trying for 15.

If an output equation must follow a strict format to be valid, like requiring to be in the input's format of "num op num = num op num", you can prune a lot of results.
15 segments only make up 73 valid equations, 20 segments make up 8414, 24 segments make up 180065, and 25 segments gives me an OoM error.

The largest possible equation with single-digit values is
8 + 8 = 8 + 8

with 34 segments, which seems too high to brute force.
The four-digit equations in the Part 3 input float around the 80-segment mark, which is definitely too high to brute force.
>>
File: 20.png (545 KB, 2096x4046)
545 KB PNG
idiomatic Rust solution
>>
So, what did we think?
Any Jane Street recruiters here can hit me up
>>
>>110392610
pretty fun overall
see you guys in aoc!
>>
File: l.png (181 KB, 1226x1976)
181 KB PNG
>>
>>110394278
Dear Sir.
For fair comparison, current best practices recommend using the "Local Time" sorting method.
>>
File: l.png (253 KB, 1442x1978)
253 KB PNG
>>110394335
Respected Sir, thank you very much for your kind guidance. I have noted the same. I will immediately do the needful and apply the "Local Time" sorting method as per the best practices you have mentioned. I shall revert back to you shortly with the update. Kindly let me know if there is anything else I can assist you with. Thanks and regards.
>>
>>110392610
Pretty good. I think 2025 was more enjoyable overall, and certainly had better opportunities for visuals. There were still some fun puzzles this time around, with Q15 being the hardest and also the one I want to optimize. Certainly a class above AoC 2025.
>>
>>110391384
As >>110391663 says, it depends on the restrictions, but if they must follow the format of Part 3, then if there are N sticks (without counting two sticks required for the equal sign), then each side of the equation must be allotted X and N-X respectively. At the same time, each side has to be equal to a value Y. We define the function f(X,Y) which returns true if it is possible for a side using X sticks to get a value Y, and returns false otherwise. So the problem becomes whether f(X,Y) and f(N-X,Y) are both true or not, so, each side can be worked on independently if X and Y are fixed (I guess with a loop going from 1 to N and and for each X, another loop from 1 to S where S is the max sum the equation can get given the format of Part 3 which have 4-digit numbers).

f(X,Y) has two numbers separated by a + or by a -. So, you can calculate how many sticks each number needs to represent their own value: 1 needs 2 sticks, 2 needs 5 sticks up to AAAA). With this you could solve f(X,Y) and therefore the problem. This is still bruteforce-ish, and I think it can be solved with dp, but I haven't thought about it well.
>>
>>110398496
>from 1 to S
Instead of 1, it shoudl be the minimum value the equation can give.
>>
>>110392610
I had fun but the difficulty was a bit light. That may be just because I've done so many puzzles across several events, but difficult AoC puzzles still sometimes make me pause for a second with no idea how to continue. The most difficult problem this year for me was Day 13 (clocks with three hands), but outside that one, I'm not sure I'm going to remember most of this year's problems.
For comparison, someone mentioned "rotating trampolines" earlier and I immediately had a war flashback. Those were the days...
>>
Reminder: If you haven't tested your program against all 100 input variations, you haven't completed the challenge.
>>
>>110398833
I failed
test events::_2026::_01::tests::input::all ... ok <0.063s>
test events::_2026::_02::tests::input::all ... ok <0.134s>
test events::_2026::_03::tests::input::all ... ok <1.850s>
test events::_2026::_04::tests::input::all ... ok <0.305s>
test events::_2026::_05::tests::input::all ... ok <0.731s>
test events::_2026::_06::tests::input::all ... ok <0.242s>
test events::_2026::_07::tests::input::all ... ok <1.166s>
test events::_2026::_08::tests::input::all ... ok <2.882s>
test events::_2026::_09::tests::input::all ... ok <0.309s>
test events::_2026::_10::tests::input::all ... ok <42.313s>
test events::_2026::_11::tests::input::all ... ok <5.880s>
test events::_2026::_12::tests::input::all ... ok <0.113s>
test events::_2026::_13::tests::input::all ... ok <0.068s>
test events::_2026::_14::tests::input::all ... ok <7.712s>
test events::_2026::_15::tests::input::all ... FAILED <0.049s>
test events::_2026::_16::tests::input::all ... ok <8.827s>
test events::_2026::_17::tests::input::all ... ok <0.083s>
test events::_2026::_18::tests::input::all ... ok <0.223s>
test events::_2026::_19::tests::input::all ... ok <0.299s>
test events::_2026::_20::tests::input::all ... ok <3.526s>
>>
>>110399904
>15
Heh, that one gave me the most trouble. Once I found the best cycle, I tried repeating that n=target/cycleLength times and finding a corresponding head/tail path for the remainder. It turned out the optimal solution was n-k iterations of the cycle, which I found just by looping k over 0 to 5 or so. I think it turned out that k=3 was optimal. When I go back to that I want to find a less brutish way.
>>
>>110399904
>>110400036
Yeah, I essentially hard-coded my Day 15 as well. I'm too lazy to make a generic solution though.



[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.