mirror of
https://github.com/parnic/advent-of-code-2023.git
synced 2025-06-16 16:50:14 -05:00
Day 21
I solved part 1 the naive way and was reasonably happy with it. I was successfully using that solution with some negative-modulus junk to brute force part 2 (I could get the correct answer for the example data's smaller number of steps), but there was no way it was completing in a reasonable amount of time or without blowing all my RAM. I was at a complete loss for how to solve part 2 the "smart" way, so I learned from this video: https://www.youtube.com/watch?v=9UOMZSL0JTg I understand why this works now, but I was not going to be getting it on my own (nor did I really want to spend the time it would have taken me to attempt to arrive at a similar solution).
This commit is contained in:
131
inputs/21.txt
Normal file
131
inputs/21.txt
Normal file
@ -0,0 +1,131 @@
|
||||
...................................................................................................................................
|
||||
..#...#....#.......#.#..##......#...............#..#....#......................................#....##.........#...##..#.#.....#...
|
||||
.....#..#............#....#.#...##..#.................#..#..................#...#.#.......#.#..#....#.....#...#.#..............#...
|
||||
.#........#...........#......................#..........#................#...#..............#......#...........#..#.....#.#........
|
||||
..#.#.#..........#.......#....#....#......#.......#...#..................#.###...........#...........##...#..........#.##.#.#.#.#..
|
||||
.#.#.........#.....#.#...........#.......##.###.....#.#.........#.#.........##.................##.........##.#.............##.#....
|
||||
...#.#...#.#...........#.#.####....................##.#........##..........#......#.............##.#...............#...............
|
||||
......##...#.##....#.......#....#...#....#..................................#......#.#.#..#.........#..........#..#...#............
|
||||
.#..#..#...#........................#......#...##.................#...............#..........##.........#..........................
|
||||
......#...#..#...#................#....#.....................#..................#...#.............#..#..#.......##.#.....#.........
|
||||
.#........#..........#...#........#...........##..............#...#..#.................#............................#.....#....#...
|
||||
...............##..####...........###..#...##.#................#.......#.................#......#........................#......#..
|
||||
....#............#.........#...........#..#.#.#..........#..........#...............#....#....###...##.........#...................
|
||||
.#.....#..#....#.#..............#..#.....#.#........................................##..#.....#....#...#..##.##...#................
|
||||
.....#.....#....#..#......#...............#....#.......#..#..............#...................#............................#........
|
||||
................#........#................#.#.........................#.....#.......#.....#.................#.....#.........#......
|
||||
......##....#..#...#....#..#............#....#...........#..##............#..#.........#.......#...#.#..........#.....#...#....#...
|
||||
....#.#...#.........#..#....#...#......#................#..##.......##.................#..#....#..........#......#.................
|
||||
..........#..#..#..#..........#........................#.................###..............##.#..#.#......#...#.##...........#......
|
||||
.###...#.......#..................#....#...............#.......#..#..#...#..#.......................#.#...#..#........#...#......#.
|
||||
.......#...........#.#..##......#................#............#.#.#......#................#.........#.....#..........#..#..#...#...
|
||||
....#.....................##....#......##...................#...............#.....#...............#..#........#.#....##.....#..#...
|
||||
.......#..#.##..#...###...#........#.............##........#......................##.........#...............#....#.#..............
|
||||
..###.......#..#......#........#...#...............###.###.........#.#.#........#...........#.........#...........#....#....#.#....
|
||||
.....#..........#......#...#.........#........#........#...#...........#.....#.#.............................#.#.......###.##.#.##.
|
||||
..#.................#.............#................#.#............#.#.....#........................#........#.................#....
|
||||
.#..##..#.#......##..........................#..#.........#.....#......#.....#.....#............................###.....##....#..#.
|
||||
.......#.#.......#............#...........#....#.......#....#...............#.#..##..##.........#....#..............#....###...#...
|
||||
...#.......#..##..#..#......................#......##......#........#...#........##.##.#..................#...#.#....##..##......#.
|
||||
...#.......#.........#.........................#...................#......#.......#...#...#.......#............#........###........
|
||||
.#.#.#...#.#........##..................#...#.#.........................#......#.....#..#.#........##............#...........#.....
|
||||
.#.#...#.....###.#........##...........#..#...##.........#...###..#.#...#....##........#...#.............#...#........##...#.....#.
|
||||
..............#..........#...#........#.......##..##........................#................#........##.........#.................
|
||||
....##.................#..................................#.............##..#.#....#...#..#...................#.....#....#.#.#.....
|
||||
....#####...##...#..##..#..#.......###.....#.#......#..#..#.##.....#..#.................#..........................#.#.##.#........
|
||||
..........#..#....##.#.................#......#...#.#.......#......##.........#..#.#.....................................#..#......
|
||||
..##..##.....#.....#....#...........#.#..........#............#.......###....................#..#..........#....#............#...#.
|
||||
......#..........#.......................#...#......#...#...#..#....#..#.....#...........#..#....#............#.....#....#.#.......
|
||||
.#..#......#...#..##................##..#...#.........#.........#.#..#..................#..........................#...#..#.##.....
|
||||
..#......#..#..................................#.....#.###.#.........#......#.#...#................#..........#....#...............
|
||||
........#..##....#...................#........#....#...#..........#...#...#..........####.....#..##.#................#.........###.
|
||||
....#..............................#..#..#..#.##......#...#...................#.##..........#..#...#..................#....###.##..
|
||||
.#..........................#.#..#...........#..#......#..#..#........................#........................##...#.#..#......#..
|
||||
............................#..#...#..................#................#..............##.#.#.#..................#...........##.#...
|
||||
.........#..###............#.....##...#..#...#.##.....##....#.....#.#.......#.#...#........##.........#.#..............#.#.....#...
|
||||
...........#............#.........#.....##...##......#.........#...##...............#.##................#............#.....#...#...
|
||||
.#####.#..#...............................#..#...............#...................#.....#.#............#................#...#.......
|
||||
.#..#...#....#....................#...........#.................................................#......##................#....##.#.
|
||||
....#......#..........#..##...#..#.##....#...#.....#.#........#...#.....#.....#......#...#..#..#..#........................#....#..
|
||||
...#.....#..........##......#..#.....##...#...#...#.#..........#..............#.....#..........#..#.....###.................###....
|
||||
.....................##...#....#....#......#...#.#.......#...........#..........#..............#.......##.................#..#.....
|
||||
..##.................#.......#...........#.##........#..##.#...........#.#....#.#.......#..##....#.#..#....#....#..................
|
||||
.....#...........#.#........#..........#..#.##.....#............#.......#..#.....##....#.#...........##.......#............#.......
|
||||
.....##.#.............##........##...........#..#.#..##.#.......#.......#..................#.#..#..#.......#.................#.#...
|
||||
.#.#..............##....#.......#......#..#........#..................#.#.##..#...#....#.#...........##.....#..#..#.........##.....
|
||||
..............##................#....#....#........#.......#...##...#.#.#........#.#...#...#..#.#.......#.#...#....................
|
||||
.............####.....#..........................#.#..................................#........#.#..##...#...#..#..................
|
||||
.#......................#.....#####.#...........#.#............#.............##....#....#.#...........##..........##...........##..
|
||||
...........#.#.#..#...##...##........#.......#.......#.#........#.......#......#............#..###....#.......#..#.....#........#..
|
||||
............#....#...............#.##............#...##....#.#...........#........#...#...##...........#..........#................
|
||||
......................#............#..##......#......#....#.......#..##......#...#....#....#....#..#..#..........#.....#.#.........
|
||||
................#.....##.......#....##..#.......#......###......#.......#....#.......#....##...........#.#....#....##....#.........
|
||||
................#..#...#.##...#...#....#.........#....#...##......#.#...#....#.............#.....#............##...#...............
|
||||
......................#....#......#.#....##...#...#...#.#.......#.....#..#.......#...#.#.##..#........#.....#....#.........#.......
|
||||
.....##..#..#......................#.#........#....#......#....#..#....#.........#..#.......#.......#.......#.#.......#.###..#.....
|
||||
.................................................................S.................................................................
|
||||
..................#...#.....#....#...........#..#.#..........#............................#....................##.....#....#.......
|
||||
.........#....#......#..#......#...#.#......#...#...#..............#....##.##........#..........##...##...#.......##.#....#........
|
||||
................#.##.#..#..............#.....#..#......#....#............#.#...###..#......#......#....#........#..##..............
|
||||
.........#.....................................#...#.#.............#.....#...........#........###.....................#.#..........
|
||||
.........#....#...........#...##..#........#..........#.#.....#.................#.#.#.##..#...#.#................#....#............
|
||||
...................#...................#...#..............#.....#.#.......#..............#......#..........###.......#..#..........
|
||||
...........#.#.............##...#...#....#.#.....#....................#.....#..#.....#........##.#....#....#...................##..
|
||||
.#................#.#.#.##.............#..#...#....#.#..####.#.......##......................#.......#....#....##................#.
|
||||
...##..............###...#.#..#..#.#...................#....#...#..#.#....##.....#.....#........#...#...#.#.#...................##.
|
||||
................................##.#..........#........#..........#.#....#.........##.......##........#............................
|
||||
...#............##......#.........#.....#.#................##......#.......#....##...#....#.....#.#..#....#.#.....#.............#..
|
||||
......#.........#.....###.##...#..#...#..#.##....#.#.....#.#.#........##...#..#..........#.............#...................#.......
|
||||
.#....#............#.....#..##....##...##.....#.#......##..#........#..........#.................#.......#......#.............#....
|
||||
...#.....#........#......#...........#..#......#.#.#...#....#.###.....##...##..#...#......#..#..........#..#..#..........#.....#...
|
||||
..#.#..#...........#.###...#.......#..........#...#.........#.#....#......#.........#...#....#...#.##....#....#..........##....#...
|
||||
......#.#...#............##.......#.......##...............#..................#.#....#..#..#..#..#...#...#...#.....................
|
||||
....#.......................#........##..#........##.....#.............#........#.#...........#.....#....##...........#..#.........
|
||||
...#.......#..#.......#......#....#......#..........#.#.#.#.......##....#....................##.........#................#..#......
|
||||
..#....................###.......##.#.....#.....#.#............##..#....#..#.................#...#..##.###............#...#..##....
|
||||
.....#......#..#...............#.....##......#.....#.......#..#.#..#....#..##.................##....#....##................#....#..
|
||||
.............##..#.........#..#..#........#..#..........#...#................###..........##.#.#.........#........#....##..#..#....
|
||||
.#.#.#.......#..............#....#...#............#.......#....#.........#........#....#............#............#...#.#..#........
|
||||
.............#.....#.........................#....#.#...........#.................#.#..#....#..........................#.##...#....
|
||||
...#......#........#.............#..................#.###....................#.#.....#........#.....#.........#.#.#.....#.#........
|
||||
.#.............#...##...........#.....#.....#.............#.........#...............###....#...#..#.#............#.#.............#.
|
||||
............##..#................#....#.......#............##.........##..................#......................#.#..#....#.......
|
||||
............#......#.....................#.#.#.#..#.#..#......#.............#.#....##.....#....#...............#.#............#....
|
||||
..#..#.#.#.#....#......#............##..............#....##.........#.......#.....#...##.....#....................#.......#.....#..
|
||||
...#...........#.......#...................#......#...#.##....##....#..#.#...##..#..........#...##............#..#........#.....#..
|
||||
.....#....#..#..##................#...#...#....#.#....#.#.............#...#..............#.##.............#..#..#....#.#...#...#.#.
|
||||
.......#..#.........#.....#..........#......#.#...#.........#.#.....#...#..........#....................#....#..........#..........
|
||||
..#.#.#.....#.........#..###...........#.##.#.......#..#..........#.#.......#......#......#.#.........#.#....#..#..#.......#....#..
|
||||
.#.........#...#......#...............#......#.#.....#.....................#.......#.#......#..................#...............##..
|
||||
..#....#..............................#.....#.##.....#........#....#......#....#....#..#....#........###..#..#..........#....#..#..
|
||||
....#.......##........##..............................#.........#...###.#........#...#.##.............##.....#.#......#..........#.
|
||||
...#.#.##.....#........#.................#...#..#........#............#..#.#........#....................#.....#........#..........
|
||||
.........#....#.........#.......##...........#.#.#.#..............#......#..#.......................#.#......................#.....
|
||||
............#........#..##..#................#..#.............#.............####....#..#.........#............................#....
|
||||
....#......#..##...#...#.#...................#.....#.....#.........#.............#...............#...............###.......#.#.....
|
||||
.#.....#..........................#...........#...............#............##......#.#..........#.......#..........................
|
||||
...##.....................#....#...#.........#...............#..#......##.#...#.#..................#.......#.......................
|
||||
...#........#....#....................#............#.#...#...............#................................##..........##....#.#....
|
||||
.#...##.....#........####....#......#.#......................#.............#..#....#.......#...........#..#.........#..............
|
||||
......#..............#...........#..##.....................#.#.......#.#..###.............#......#.......#..#...#...............#..
|
||||
...#....#...................##...................#.#.#.#...##.....#.#.......#.#..........#............#..............##.......#....
|
||||
...........#.................##.........#..............#.......##..##..#.#................##.#.#..#.#.#.............#..............
|
||||
........#..##.....#.#.......#.........................#....##.........###.....##........#..........#..#...#............#...#....#..
|
||||
...................#.#.#......#..#.........#............#..#........#........#............#....#...........#.......................
|
||||
.......#..........#.............#.#.#..#....#...............#..............#...........##..#...#..................#..........##..#.
|
||||
..............##....#....#..#.....#..........#.........#.#...#.....###..#.............#...................#..#.#.#....##..#....#...
|
||||
...##..........#.....#.#.#...##...#...#........#............#........#.#..............#.....#........#..##...........#.#........#..
|
||||
.#..#.#....#..##.##....##.#....##....#...#...#..........#..##.......#...................#.......##..........#........#...#.#....#..
|
||||
.#..#....#........#......#...............###.............#..........#...#...............#........#...#...###....#..#.#.........#...
|
||||
.....#.........#.#..#....#...#.....#......#.................#...#....#...............#.........#.........#...........#.#...........
|
||||
..##.....#..........#...#..#.....#....#.#.....................#...#.................#.....#..#...#.#................#.........##.#.
|
||||
.........#..#.##........#...####......#.......#................#...#............#..#.#...........#....#.....#.#....#...###.........
|
||||
.........#......#...#...#....#...#.....##..#..##.....#..............#........#........#.........#...........#.....#......#.#..#....
|
||||
...##.......#.....#....#.............#.##...#.#....................................#.#...#...............#...................#.....
|
||||
......................#.###.............#........#.................................#.##........#..#.#.............##...#...........
|
||||
...#........#....#.....#.#...........#.#.......#....#.............#................#.....#..#..#..#.#.......#...#.....#.....##.....
|
||||
.##.#....#.........#........##......#................##............................#...#..................#...##............##.....
|
||||
......#.......#........#..#.#...#.........#............#.#........................#..#....#.#...##.........#...#..........##.......
|
||||
............#.#...#.....#..#..........#.....#..........................###.#.......##..#......#...#......#.........##...###.....#..
|
||||
.#.#......#.#..............#............#..........#.#....................#......#..#...#....#..#.#......#...............#.#.......
|
||||
...................................................................................................................................
|
11
inputs/21a.txt
Normal file
11
inputs/21a.txt
Normal file
@ -0,0 +1,11 @@
|
||||
...........
|
||||
.....###.#.
|
||||
.###.##..#.
|
||||
..#.#...#..
|
||||
....#.#....
|
||||
.##..S####.
|
||||
.##..#...#.
|
||||
.......##..
|
||||
.##.#.####.
|
||||
.##..##.##.
|
||||
...........
|
Reference in New Issue
Block a user