diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-12-11 06:30:36 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-12-11 06:30:36 +0100 |
| commit | e5e8007197489a84d2fc3c499efe822642ba682e (patch) | |
| tree | 72666ca39016efa3df9efaee3e9eaa88ad18d8e9 /2025/README.md | |
| parent | f8944a95b16e2b09ad0d1b61ee5ba37d2755807f (diff) | |
| download | aoc-e5e8007197489a84d2fc3c499efe822642ba682e.tar.gz aoc-e5e8007197489a84d2fc3c499efe822642ba682e.zip | |
Day 11 2025
Diffstat (limited to '2025/README.md')
| -rw-r--r-- | 2025/README.md | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/2025/README.md b/2025/README.md index 09d97c1..951213c 100644 --- a/2025/README.md +++ b/2025/README.md | |||
| @@ -11,6 +11,7 @@ Example | |||
| 11 | 11 | ||
| 12 | ``` | 12 | ``` |
| 13 | Day -Part 1- -Part 2- | 13 | Day -Part 1- -Part 2- |
| 14 | 11 00:14:22 00:21:19 | ||
| 14 | 10 00:27:43 11:51:51 | 15 | 10 00:27:43 11:51:51 |
| 15 | 9 00:05:05 02:11:41 | 16 | 9 00:05:05 02:11:41 |
| 16 | 8 00:29:14 00:33:02 | 17 | 8 00:29:14 00:33:02 |
| @@ -213,3 +214,16 @@ AoC problem (see `../2023/24/24b.c`). | |||
| 213 | 214 | ||
| 214 | This time I left some comments in the code, so check out `10/b.py` if | 215 | This time I left some comments in the code, so check out `10/b.py` if |
| 215 | you want to know the details. | 216 | you want to know the details. |
| 217 | |||
| 218 | ### Day 11: Reactor | ||
| 219 | |||
| 220 | This is very easy, at least if you have ever worked with graphs. For | ||
| 221 | part 1I have implemented a recursive function `np(v)` that counts the | ||
| 222 | number of paths from a node `v` to `out`: it returns 1 if `v == out`, | ||
| 223 | or the sum of `np(w)` for all neighbors `w` of `v` otherwise. | ||
| 224 | |||
| 225 | For part 2 the function takes 2 extra parameters that denote whether | ||
| 226 | or not we have passed through the two required intermediate nodes. | ||
| 227 | |||
| 228 | The paths in part 1 are small enough that memoization is not required, | ||
| 229 | but in part 2 we need to cache the intermediate results. | ||
