Files
2023/inputs/21.txt
Parnic bf16614487 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).
2023-12-21 09:50:37 -06:00

131 lines
17 KiB
Plaintext

...................................................................................................................................
..#...#....#.......#.#..##......#...............#..#....#......................................#....##.........#...##..#.#.....#...
.....#..#............#....#.#...##..#.................#..#..................#...#.#.......#.#..#....#.....#...#.#..............#...
.#........#...........#......................#..........#................#...#..............#......#...........#..#.....#.#........
..#.#.#..........#.......#....#....#......#.......#...#..................#.###...........#...........##...#..........#.##.#.#.#.#..
.#.#.........#.....#.#...........#.......##.###.....#.#.........#.#.........##.................##.........##.#.............##.#....
...#.#...#.#...........#.#.####....................##.#........##..........#......#.............##.#...............#...............
......##...#.##....#.......#....#...#....#..................................#......#.#.#..#.........#..........#..#...#............
.#..#..#...#........................#......#...##.................#...............#..........##.........#..........................
......#...#..#...#................#....#.....................#..................#...#.............#..#..#.......##.#.....#.........
.#........#..........#...#........#...........##..............#...#..#.................#............................#.....#....#...
...............##..####...........###..#...##.#................#.......#.................#......#........................#......#..
....#............#.........#...........#..#.#.#..........#..........#...............#....#....###...##.........#...................
.#.....#..#....#.#..............#..#.....#.#........................................##..#.....#....#...#..##.##...#................
.....#.....#....#..#......#...............#....#.......#..#..............#...................#............................#........
................#........#................#.#.........................#.....#.......#.....#.................#.....#.........#......
......##....#..#...#....#..#............#....#...........#..##............#..#.........#.......#...#.#..........#.....#...#....#...
....#.#...#.........#..#....#...#......#................#..##.......##.................#..#....#..........#......#.................
..........#..#..#..#..........#........................#.................###..............##.#..#.#......#...#.##...........#......
.###...#.......#..................#....#...............#.......#..#..#...#..#.......................#.#...#..#........#...#......#.
.......#...........#.#..##......#................#............#.#.#......#................#.........#.....#..........#..#..#...#...
....#.....................##....#......##...................#...............#.....#...............#..#........#.#....##.....#..#...
.......#..#.##..#...###...#........#.............##........#......................##.........#...............#....#.#..............
..###.......#..#......#........#...#...............###.###.........#.#.#........#...........#.........#...........#....#....#.#....
.....#..........#......#...#.........#........#........#...#...........#.....#.#.............................#.#.......###.##.#.##.
..#.................#.............#................#.#............#.#.....#........................#........#.................#....
.#..##..#.#......##..........................#..#.........#.....#......#.....#.....#............................###.....##....#..#.
.......#.#.......#............#...........#....#.......#....#...............#.#..##..##.........#....#..............#....###...#...
...#.......#..##..#..#......................#......##......#........#...#........##.##.#..................#...#.#....##..##......#.
...#.......#.........#.........................#...................#......#.......#...#...#.......#............#........###........
.#.#.#...#.#........##..................#...#.#.........................#......#.....#..#.#........##............#...........#.....
.#.#...#.....###.#........##...........#..#...##.........#...###..#.#...#....##........#...#.............#...#........##...#.....#.
..............#..........#...#........#.......##..##........................#................#........##.........#.................
....##.................#..................................#.............##..#.#....#...#..#...................#.....#....#.#.#.....
....#####...##...#..##..#..#.......###.....#.#......#..#..#.##.....#..#.................#..........................#.#.##.#........
..........#..#....##.#.................#......#...#.#.......#......##.........#..#.#.....................................#..#......
..##..##.....#.....#....#...........#.#..........#............#.......###....................#..#..........#....#............#...#.
......#..........#.......................#...#......#...#...#..#....#..#.....#...........#..#....#............#.....#....#.#.......
.#..#......#...#..##................##..#...#.........#.........#.#..#..................#..........................#...#..#.##.....
..#......#..#..................................#.....#.###.#.........#......#.#...#................#..........#....#...............
........#..##....#...................#........#....#...#..........#...#...#..........####.....#..##.#................#.........###.
....#..............................#..#..#..#.##......#...#...................#.##..........#..#...#..................#....###.##..
.#..........................#.#..#...........#..#......#..#..#........................#........................##...#.#..#......#..
............................#..#...#..................#................#..............##.#.#.#..................#...........##.#...
.........#..###............#.....##...#..#...#.##.....##....#.....#.#.......#.#...#........##.........#.#..............#.#.....#...
...........#............#.........#.....##...##......#.........#...##...............#.##................#............#.....#...#...
.#####.#..#...............................#..#...............#...................#.....#.#............#................#...#.......
.#..#...#....#....................#...........#.................................................#......##................#....##.#.
....#......#..........#..##...#..#.##....#...#.....#.#........#...#.....#.....#......#...#..#..#..#........................#....#..
...#.....#..........##......#..#.....##...#...#...#.#..........#..............#.....#..........#..#.....###.................###....
.....................##...#....#....#......#...#.#.......#...........#..........#..............#.......##.................#..#.....
..##.................#.......#...........#.##........#..##.#...........#.#....#.#.......#..##....#.#..#....#....#..................
.....#...........#.#........#..........#..#.##.....#............#.......#..#.....##....#.#...........##.......#............#.......
.....##.#.............##........##...........#..#.#..##.#.......#.......#..................#.#..#..#.......#.................#.#...
.#.#..............##....#.......#......#..#........#..................#.#.##..#...#....#.#...........##.....#..#..#.........##.....
..............##................#....#....#........#.......#...##...#.#.#........#.#...#...#..#.#.......#.#...#....................
.............####.....#..........................#.#..................................#........#.#..##...#...#..#..................
.#......................#.....#####.#...........#.#............#.............##....#....#.#...........##..........##...........##..
...........#.#.#..#...##...##........#.......#.......#.#........#.......#......#............#..###....#.......#..#.....#........#..
............#....#...............#.##............#...##....#.#...........#........#...#...##...........#..........#................
......................#............#..##......#......#....#.......#..##......#...#....#....#....#..#..#..........#.....#.#.........
................#.....##.......#....##..#.......#......###......#.......#....#.......#....##...........#.#....#....##....#.........
................#..#...#.##...#...#....#.........#....#...##......#.#...#....#.............#.....#............##...#...............
......................#....#......#.#....##...#...#...#.#.......#.....#..#.......#...#.#.##..#........#.....#....#.........#.......
.....##..#..#......................#.#........#....#......#....#..#....#.........#..#.......#.......#.......#.#.......#.###..#.....
.................................................................S.................................................................
..................#...#.....#....#...........#..#.#..........#............................#....................##.....#....#.......
.........#....#......#..#......#...#.#......#...#...#..............#....##.##........#..........##...##...#.......##.#....#........
................#.##.#..#..............#.....#..#......#....#............#.#...###..#......#......#....#........#..##..............
.........#.....................................#...#.#.............#.....#...........#........###.....................#.#..........
.........#....#...........#...##..#........#..........#.#.....#.................#.#.#.##..#...#.#................#....#............
...................#...................#...#..............#.....#.#.......#..............#......#..........###.......#..#..........
...........#.#.............##...#...#....#.#.....#....................#.....#..#.....#........##.#....#....#...................##..
.#................#.#.#.##.............#..#...#....#.#..####.#.......##......................#.......#....#....##................#.
...##..............###...#.#..#..#.#...................#....#...#..#.#....##.....#.....#........#...#...#.#.#...................##.
................................##.#..........#........#..........#.#....#.........##.......##........#............................
...#............##......#.........#.....#.#................##......#.......#....##...#....#.....#.#..#....#.#.....#.............#..
......#.........#.....###.##...#..#...#..#.##....#.#.....#.#.#........##...#..#..........#.............#...................#.......
.#....#............#.....#..##....##...##.....#.#......##..#........#..........#.................#.......#......#.............#....
...#.....#........#......#...........#..#......#.#.#...#....#.###.....##...##..#...#......#..#..........#..#..#..........#.....#...
..#.#..#...........#.###...#.......#..........#...#.........#.#....#......#.........#...#....#...#.##....#....#..........##....#...
......#.#...#............##.......#.......##...............#..................#.#....#..#..#..#..#...#...#...#.....................
....#.......................#........##..#........##.....#.............#........#.#...........#.....#....##...........#..#.........
...#.......#..#.......#......#....#......#..........#.#.#.#.......##....#....................##.........#................#..#......
..#....................###.......##.#.....#.....#.#............##..#....#..#.................#...#..##.###............#...#..##....
.....#......#..#...............#.....##......#.....#.......#..#.#..#....#..##.................##....#....##................#....#..
.............##..#.........#..#..#........#..#..........#...#................###..........##.#.#.........#........#....##..#..#....
.#.#.#.......#..............#....#...#............#.......#....#.........#........#....#............#............#...#.#..#........
.............#.....#.........................#....#.#...........#.................#.#..#....#..........................#.##...#....
...#......#........#.............#..................#.###....................#.#.....#........#.....#.........#.#.#.....#.#........
.#.............#...##...........#.....#.....#.............#.........#...............###....#...#..#.#............#.#.............#.
............##..#................#....#.......#............##.........##..................#......................#.#..#....#.......
............#......#.....................#.#.#.#..#.#..#......#.............#.#....##.....#....#...............#.#............#....
..#..#.#.#.#....#......#............##..............#....##.........#.......#.....#...##.....#....................#.......#.....#..
...#...........#.......#...................#......#...#.##....##....#..#.#...##..#..........#...##............#..#........#.....#..
.....#....#..#..##................#...#...#....#.#....#.#.............#...#..............#.##.............#..#..#....#.#...#...#.#.
.......#..#.........#.....#..........#......#.#...#.........#.#.....#...#..........#....................#....#..........#..........
..#.#.#.....#.........#..###...........#.##.#.......#..#..........#.#.......#......#......#.#.........#.#....#..#..#.......#....#..
.#.........#...#......#...............#......#.#.....#.....................#.......#.#......#..................#...............##..
..#....#..............................#.....#.##.....#........#....#......#....#....#..#....#........###..#..#..........#....#..#..
....#.......##........##..............................#.........#...###.#........#...#.##.............##.....#.#......#..........#.
...#.#.##.....#........#.................#...#..#........#............#..#.#........#....................#.....#........#..........
.........#....#.........#.......##...........#.#.#.#..............#......#..#.......................#.#......................#.....
............#........#..##..#................#..#.............#.............####....#..#.........#............................#....
....#......#..##...#...#.#...................#.....#.....#.........#.............#...............#...............###.......#.#.....
.#.....#..........................#...........#...............#............##......#.#..........#.......#..........................
...##.....................#....#...#.........#...............#..#......##.#...#.#..................#.......#.......................
...#........#....#....................#............#.#...#...............#................................##..........##....#.#....
.#...##.....#........####....#......#.#......................#.............#..#....#.......#...........#..#.........#..............
......#..............#...........#..##.....................#.#.......#.#..###.............#......#.......#..#...#...............#..
...#....#...................##...................#.#.#.#...##.....#.#.......#.#..........#............#..............##.......#....
...........#.................##.........#..............#.......##..##..#.#................##.#.#..#.#.#.............#..............
........#..##.....#.#.......#.........................#....##.........###.....##........#..........#..#...#............#...#....#..
...................#.#.#......#..#.........#............#..#........#........#............#....#...........#.......................
.......#..........#.............#.#.#..#....#...............#..............#...........##..#...#..................#..........##..#.
..............##....#....#..#.....#..........#.........#.#...#.....###..#.............#...................#..#.#.#....##..#....#...
...##..........#.....#.#.#...##...#...#........#............#........#.#..............#.....#........#..##...........#.#........#..
.#..#.#....#..##.##....##.#....##....#...#...#..........#..##.......#...................#.......##..........#........#...#.#....#..
.#..#....#........#......#...............###.............#..........#...#...............#........#...#...###....#..#.#.........#...
.....#.........#.#..#....#...#.....#......#.................#...#....#...............#.........#.........#...........#.#...........
..##.....#..........#...#..#.....#....#.#.....................#...#.................#.....#..#...#.#................#.........##.#.
.........#..#.##........#...####......#.......#................#...#............#..#.#...........#....#.....#.#....#...###.........
.........#......#...#...#....#...#.....##..#..##.....#..............#........#........#.........#...........#.....#......#.#..#....
...##.......#.....#....#.............#.##...#.#....................................#.#...#...............#...................#.....
......................#.###.............#........#.................................#.##........#..#.#.............##...#...........
...#........#....#.....#.#...........#.#.......#....#.............#................#.....#..#..#..#.#.......#...#.....#.....##.....
.##.#....#.........#........##......#................##............................#...#..................#...##............##.....
......#.......#........#..#.#...#.........#............#.#........................#..#....#.#...##.........#...#..........##.......
............#.#...#.....#..#..........#.....#..........................###.#.......##..#......#...#......#.........##...###.....#..
.#.#......#.#..............#............#..........#.#....................#......#..#...#....#..#.#......#...............#.#.......
...................................................................................................................................