Elektrine lite

← Feed

@piko@chaos.social

Post #1341708

2026-04-14 17:10 UTC

@blinry and I are still trying to solve last year's #adventOfCode. We're stuck on day 10, and we're out of ideas – except using linear optimization algorithms, but that feels like overkill... Has anyone of you solved day 10 and has a tip for us – do we really need to implement linear optimization? https://en.wikipedia.org/wiki/Linear_programming#Integer_unknowns Please use a spoiler for your answers ^^' #AOC25 #advent_of_code #adventofcode2025 #adventofcode2025day10

Replies (6)

  • @movq@tilde.zone 2026-04-14 17:36

    @piko @blinry I haven’t found a great solution myself, but I have this link in my notes of someone who used some DFS thingy: https://old.reddit.com/r/adventofcode/comments/1pity70/2025_day_10_solutions/ntb36sb/ I did not dig through this at all (it’s still on the “TODO later” list 😅), so I can’t vouch for it. Still, maybe you two can get some useful pointers here … ?

    Open ##1446413

  • @inguin@nerdculture.de 2026-04-14 17:54

    @piko @blinry I think the majority of participants did indeed resort to using a linear programming package. Personally, I went with the "linprog" solver from the scipy package. Later I found a Reddit thread where somebody described an efficient recursive algorithm to solve the problem. It sounds both clever and straightforward, but I never took the time to try and implement it myself: https://www.reddit.com/r/adventofcode/comments/1pk87hl/2025_day_10_part_2_bifurcate_your_way_to_victory/

    Open ##1446414

  • @psychotimmy@oldbytes.space 2026-04-14 18:22

    @piko @blinry You can see my scruffy handwritten notes on an approach here https://z80.timholyoake.uk/advent-of-code-2025-in-fortran-77-mostly/ along with a link to my repository with my final version in it. It's written in fixed width Fortran, but uses recursion, so is a bit of a hybrid between legacy and modern Fortran! It should be relatively readable though as the final code includes comments.

    Open ##1446415

  • @fiveop@mastodon.fiveop.de 2026-04-14 18:28

    @piko @blinry https://en.wikipedia.org/wiki/Dynamic_programming#Mathematical_optimization Linear optimization is probably overkill for part 1

    Open ##1446416

  • @darkdust@muenchen.social 2026-04-14 19:42

    @piko @blinry I first solved part 2 with a recursive algorithm. After some optimisations it found the solution in 16min (Rust). Then I learned about Z3, which a lot of people used, which actually was quite interesting. This solution solves part 2 in less than a second, of course.

    Open ##1446417

  • @dj3ei@mastodon.radio 2026-04-14 21:55

    https://adventofcode.com/2025/day/10 , right? I did not code a solution and only read what's on that page, didn't log in. It does not matter in which order buttons are pressed. It does not make sense to press the same button twice, as the second press only reverts what the first did. Potential solution to the problem can be mapped to subsets of buttons. Generate all subsets of buttons, ordered by number of elements in that subset. @piko @blinry

    Open ##1446418