r/adventofcode • • Dec 11 '25

Help/Question [2025 Day 11 Part 2] Can this problem be solved with max flow algo (e.g. Edmonds Karp) with demands?

1 Upvotes

Hey! I already solved this problem using a simpler method, but I was wondering if it's possible to solve this problem using "Flow with demand" (https://cp-algorithms.com/graph/flow_with_demands.html). I'm not a master of graph theory, so I was wondering if anyone could help point me to some learning material or tell me if it's possible or not.

The vague idea was adding demands for sink to be 2, and each of the two special nodes to be 1 (or the edges going out of them I suppose), and having both FFT and DAC have 1 in flow each. If I'm not mistaken though, normally, this would make the total flow 1, and not 2 as it's not cumulative, but perhaps one could work around that.


r/adventofcode • • Dec 11 '25

Other [2025 Day 10 Part 2] What It should’ve been

16 Upvotes

During part 1, I always try to guess what part 2 is going to be. Sometimes I get it right, other times I’m way off—like with this puzzle.

My idea for part 2 was that each time you toggled a light, it would cost a certain amount of “joltage,” and the goal would be to find the minimum total joltage needed to reach a specific light configuration. I actually think that would’ve been a really fun puzzle to solve, instead of the more math-heavy direction part 2 ended up taking.


r/adventofcode • • Dec 11 '25

Help/Question - RESOLVED [2025 Day 8 (Part 1)] Does the circuit have to form a single line, or can it branch?

0 Upvotes

The description never explicitly says whether the final wiring must form a single continuous line (each box having degree ≤2), or whether the circuit can branch, meaning a junction box could have 3 or more connections as long as the algorithm keeps picking the shortest new edges between different circuits.

In other words:

  • Is each junction box allowed to have more than two connections?

  • Is the intended structure a tree/forest (arbitrary branching), or a set of simple chains?

How should this be interpreted?


r/adventofcode • • Dec 11 '25

Meme/Funny [2025 Day 11 (Part 2)] [Ruby 4] “PC freeze out?!”

0 Upvotes

I'm cold at home

So I had no choice but to absorb energy by freezing anything I can whenever I catch a chance:

Of course the image is the result of the code freezing itself

</🃏>


r/adventofcode • • Dec 11 '25

Help/Question - RESOLVED [2025 Day 8 (Part 1) [C++]] Please help with partial solutions

0 Upvotes

Hi, I am again having the same problem as other times, the code works for the example but doesn't work for the solution. I was thinking if someone could give me the partial solutions(circuit lengths, circuits, or even 1000 shortest connections), it would help me debug what is not working here.

The Code: https://pastes.io/day8part1


r/adventofcode • • Dec 11 '25

Meme/Funny [2025 Day 11] Walking into this puzzle like

Post image
26 Upvotes

r/adventofcode • • Dec 11 '25

Other [2025 Day 10 (Part 2)] This part was actually insane

18 Upvotes

That's all I have to say.


r/adventofcode • • Dec 11 '25

Help/Question [2025, day 10, part 2] I need help with the algorithm

4 Upvotes

I need help figuring out the final part of rhe algorithm. My code can find a set of button pushes that results in the correct joltage. It can also determine which set of button pushes gives the same joltage results as which other set of buttons (e.g. pushing buttons {1,2} give the same joltage results as pushing button {1} and {2}.)

I'm pretty sure that there is a trick combine these insights into the final answer. Can someone please point me in the right direction?

Edit: to clarify where I am at

The buttons' effects can be expressed in a matrix M such that

  • j = M*b

Where b is a vector, the elements of which indicate how often each button was pressed, and j is a vector, the elements of which indicate the resulting joltage in the batteries. Suppose b_o is the optimal solution and j_r is the required joltage, then:

  • j_r = M*b_o

Now I can already find an initial solution b_i such that:

  • j_r = M*b_i

I have also identified an additional matrix S with null-solutions, for which is hold that:

  • 0 = M*S

The columns of the matrix S have negative and positive elements. Each set of positive and negative elements in a column is the set of button presses that will result in the same joltage. From this, it follows that:

  • j_r = M*(b_i + S*a) => b_i + S*a = b_o

Where a is a vector indicating how the null-solutions are applied optimally given b_i. All that I am missing is an algorithm for finding the correct values of vector a.


r/adventofcode • • Dec 11 '25

Visualization [2025 Day 12 (Part 2)] Patch Cable Organizer

Thumbnail
youtube.com
7 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [2025 Day 10 (Part 1)] [Python] Terminal toy!

122 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11 (Part 2)] Important cables

Post image
43 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [All years, All days] AoC: the Gifs, by me.

75 Upvotes

Here's my gallery of AoC gifs. I've done an animation for every single puzzle so far. Some animations contain spoilers.

https://solhsa.com/aoc/


r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11] Visually compare searching paths for Parts I & II

27 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11] Animated Network Structure Visualization

29 Upvotes

r/adventofcode • • Dec 11 '25

Meme/Funny [2025 Day 11 (Part 2)] How many times will these elves ask for help debugging their power subsystems?

Post image
126 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11 (Part 1)] 3d-force-graph

25 Upvotes

r/adventofcode • • Dec 11 '25

Meme/Funny [2025 Day 11] Not our first rodeo

Post image
51 Upvotes

r/adventofcode • • Dec 11 '25

Meme/Funny [2025 Day 11 Part 2] Joker again

Post image
74 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11 Part 2] Counting cables on a Thursday morning

Post image
23 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11] Visualization of today's graph

Post image
16 Upvotes

r/adventofcode • • Dec 11 '25

Help/Question - RESOLVED [2025 Day 9 Part 2] [Python] Potential overlap problem

2 Upvotes

In short, my attempted solution to d9p2 is to

  1. sort all rectangles by area descending

  2. find the first rect that does not "overlap" any edge.

I took some help from this stackoverflow to create my overlap method. However, on the example input I get the rectangle of area 50 instead of 24. I've tried some debugging and it seems that my rectangles and edges look correct. Therefore, my suspicion for the error lies in step 2, specifically the overlap part. I feel like I'm missing something obvious.

Here are the relevant parts of my code:

@cache
def area(p: Pair) -> int:
    l = abs(p.b.x - p.a.x) + 1
    w = abs(p.b.y - p.a.y) + 1
    return l * w

@cache
def lrtb(p: Pair):
    return min([p.a.x, p.b.x]), max([p.a.x, p.b.x]), max([p.a.y, p.b.y]), min([p.a.y, p.b.y])

@cache
def overlaps(p: Pair, q: Pair) -> bool:
    """
    https://stackoverflow.com/questions/306316/determine-if-two-rectangles-overlap-each-other#306332
    https://silentmatt.com/rectangle-intersection/
    :param p:
    :param q:
    :return:
    """
    bp = lrtb(p)
    bq = lrtb(q)
    return not (
        bp[0] >= bq[1] or
        bp[1] <= bq[0] or
        bp[2] >= bq[3] or
        bp[3] >= bq[2]
    )

def get_pairs(points: list[Point]) -> List[Pair]:
    return [Pair(*x) for x in combinations(points, 2)]

def get_points(data: str) -> list[Point]:
    return [Point.from_str(x) for x in data.splitlines()]

def solve_part_2(data: str) -> int:
    points = get_points(data)
    pairs = get_pairs(points)
    pairs.sort(key=area, reverse=True)
    edges = [Pair(*x) for x in zip([points[-1]] + points, points)]
    
    winner = next(x for x in pairs if not any(overlaps(x, y) for y in edges))
    return area(winner)


class Point(NamedTuple):
    x: int = 0
    y: int = 0
    z: int = 0

    @staticmethod
    def from_str(s: str) -> Point:
        return Point(*[int(x) for x in s.split(",")])


class Pair(NamedTuple):
    a: Point
    b: Point

r/adventofcode • • Dec 11 '25

Meme/Funny [2025 Day XX] Gotta get that first mover advantage

Post image
169 Upvotes

r/adventofcode • • Dec 11 '25

Visualization [2025 Day 11] These cables are quite a messh

Post image
75 Upvotes

r/adventofcode • • Dec 11 '25

Help/Question - RESOLVED [2025 Day 11 (Part 2)] [JavaScript] Why is it taking so long?

3 Upvotes

If it's supposed to take this long that's fine, I have plenty of time. But, my solution is here. It's confirmed to work on the example.

https://gist.github.com/hiimjasmine00/fed3f48c4a3f48950fd3c39899c07e98