aoc21
AdventOfCode
aoc21 | AdventOfCode | |
---|---|---|
4 | 18 | |
2 | 58 | |
- | - | |
0.0 | 7.5 | |
over 1 year ago | 15 days ago | |
Crystal | Python | |
- | Creative Commons Zero v1.0 Universal |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
aoc21
-
Advent of Code Day 24: Computing with Sets
The way I solved this was by squinting a little and realizing that every time a div instruction happened, then a certain number following it needed to be 0, depending on the value of certain constants embedded in the code, and also on certain other fields in the input. So instead of starting with an input number, it is possible to calculate the min and max values the fields may contain right there, as long as we embed the field positions in a stack.
As this is only going through the code once, this is virtually instantaneous and ended up as the day that was fastest of all days to compute.
https://github.com/yxhuvud/aoc21/blob/main/day24.cr
-
[2021] Solving AoC with Rust before Python can start
My solution, https://github.com/yxhuvud/aoc21/blob/main/all_days.cr :
-
Speeding up Dijkstra by a factor of 2700
Yes, though sometimes it is possible to replace a fully general priority queue with a faster structure that is using the structure of the problem at hand. For example, this problem (AoC day 15) has only ever a count of unique priorities that is 10 or fewer. That allows a queue implementation to be https://github.com/yxhuvud/aoc21/blob/main/day15.cr#L27-L51 , being amortized O(1) in both insertion and deletion. This pushed down the runtime another magnitude for me, the whole day running at 0.014s.
- -🎄- 2021 Day 18 Solutions -🎄-
AdventOfCode
-
[2016 Day 14 (Part 2)][Python] Is there a trick to speed this up?
Here's an example implementation in Rust, using rayon's parallel iterators to automatically distribute the computation of a range of hashes over all available cores. It solves both parts together in around 3 seconds on my M2 MacBook Pro. Single-threaded, it takes around 25s in Rust and 35s in Python.
-
Need help finding good python solutions
Here are mine: https://github.com/benediktwerner/AdventOfCode
- [2022 All Days]
-
Running time goals (more of a survey question)
I love doing optimizations like this but I don't really have enough time anymore to really do it. In 2020 I spent a fair amount of time writing super optimized solutions for the first 10 or so days (repo solving all those days together in 150us i.e. <1ms) but even back then, I eventually stopped since I had other things to do and it took more and more time as the days went on.
- [2022 Day 8] Anyone have a solution that doesnt have a separate function for every direction?
-
-🎄- 2022 Day 5 Solutions -🎄-
Python 3 116/125
-
-🎄- 2021 Day 24 Solutions -🎄-
Wow, my final solution looks almost exactly the same. Though I calculated my initial answers by hand.
-
[2021 Day 18] When you check the leaderboard first and see most people taking 30+ minutes
That's certainly not necessary though and really not what makes most of the speed, especially for problems like today's. I don't really look at other leaderboard competitor's solutions much but at least my solutions (ranked ~20 today) are almost always completely vanilla Python (the only exception is networkx for the occasional graph problem but even that isn't really that much of a speedup if you know the common graph algorithms) and always self-contained.
-
-🎄- 2021 Day 18 Solutions -🎄-
Interesting approach. I guess mine could be considered a bit nicer, doing it recursively and returning the number to add to the left or right.
-
[2021 Day 15 (Part B)] [Golang] Pretty Organic, If You Ask Me.
My priority Q/heap Dijkstra in Python runs just fine. I don't remember and can't check rn if it was instant or took a second but it definitely wasn't longer than that.
What are some alternatives?
nom - Rust parser combinator framework
advent-of-code-2020 - :christmas_tree: My Advent of Code solutions in Rust. http://adventofcode.com/2020
Advent-of-Code - Advent of Code
advent_of_code_2021_v2
aoc
advent-of-code
adventofcode - Advent of Code challenge solutions
AOC2021-in-Fortran - Advent of Code 2021 solutions in Fortran
adventofcode - :christmas_tree: Advent of Code (2015-2023) in C#
AdventOfCode2021.jl - Advent of Code 2021 in Julia
grapher - Grapher is a Python class that generates a 2D graph object for displaying (x, y) data as text.
advent-of-code-2021