1
0
Fork 0

Compare commits

...

2 commits

Author SHA1 Message Date
2167efbb3a
Day twenty-two 2024-12-22 21:06:40 -05:00
6dd5d78331
Day twenty 2024-12-21 10:16:48 -05:00
4 changed files with 2644 additions and 0 deletions

141
20/input Normal file
View file

@ -0,0 +1,141 @@
#############################################################################################################################################
#...#...###...#####...#...#.......#####.....#...#.........###...###...#.....#...#.......#.....#...#...###...#.......#...........#.....#.....#
#.#.#.#.###.#.#####.#.#.#.#.#####.#####.###.#.#.#.#######.###.#.###.#.#.###.#.#.#.#####.#.###.#.#.#.#.###.#.#.#####.#.#########.#.###.#.###.#
#.#.#.#.#...#...#...#.#.#.#.....#...#...#...#.#...#.......#...#.#...#.#.#...#.#.#...#...#...#...#...#.#...#.#...#...#.#.........#...#.#...#.#
#.#.#.#.#.#####.#.###.#.#.#####.###.#.###.###.#####.#######.###.#.###.#.#.###.#.###.#.#####.#########.#.###.###.#.###.#.###########.#.###.#.#
#.#.#.#.#.....#...#...#.#.#.....#...#...#.#...#.....#...###.#...#...#.#.#...#.#.###.#.#...#.....#.....#...#.#...#.....#.....#...#...#...#.#.#
#.#.#.#.#####.#####.###.#.#.#####.#####.#.#.###.#####.#.###.#.#####.#.#.###.#.#.###.#.#.#.#####.#.#######.#.#.#############.#.#.#.#####.#.#.#
#.#...#.......#.....#...#.#.....#...#...#.#.#...#.....#...#.#.#...#.#.#.#...#.#.#...#.#.#.#...#.#...#...#.#.#.#.............#.#...#.....#.#.#
#.#############.#####.###.#####.###.#.###.#.#.###.#######.#.#.#.#.#.#.#.#.###.#.#.###.#.#.#.#.#.###.#.#.#.#.#.#.#############.#####.#####.#.#
#.#...#...#...#...###.#...#...#.#...#...#...#...#...#.....#.#.#.#.#.#.#.#...#.#...#...#.#.#.#.#.#...#.#.#.#.#.#.....#...###...#.....#...#.#.#
#.#.#.#.#.#.#.###.###.#.###.#.#.#.#####.#######.###.#.#####.#.#.#.#.#.#.###.#.#####.###.#.#.#.#.#.###.#.#.#.#.#####.#.#.###.###.#####.#.#.#.#
#...#.#.#...#...#...#.#.#...#.#.#.#...#...#.....#...#...###.#.#.#.#.#...#...#.#.....#...#...#.#.#.....#...#...#...#.#.#...#...#.......#...#.#
#####.#.#######.###.#.#.#.###.#.#.#.#.###.#.#####.#####.###.#.#.#.#.#####.###.#.#####.#######.#.###############.#.#.#.###.###.#############.#
#...#.#.###...#.#...#.#.#...#.#.#.#.#.#...#...#...#.....#...#...#.#.....#...#.#.#...#.....#...#.#.....#.........#...#...#.....#...#...#.....#
#.#.#.#.###.#.#.#.###.#.###.#.#.#.#.#.#.#####.#.###.#####.#######.#####.###.#.#.#.#.#####.#.###.#.###.#.###############.#######.#.#.#.#.#####
#.#...#.#...#...#.....#...#.#.#.#.#.#.#...#...#...#.....#.......#.###...#...#.#...#...###.#.###.#.###.#.....#...#...###.#.......#...#...#...#
#.#####.#.###############.#.#.#.#.#.#.###.#.#####.#####.#######.#.###.###.###.#######.###.#.###.#.###.#####.#.#.#.#.###.#.###############.#.#
#.......#.........#.....#.#.#...#...#.###.#.#...#.....#...###...#.....#...###...#.....#...#...#...#...#...#...#...#.#...#.#...#...#...###.#.#
#################.#.###.#.#.#########.###.#.#.#.#####.###.###.#########.#######.#.#####.#####.#####.###.#.#########.#.###.#.#.#.#.#.#.###.#.#
#.................#.#...#.#.....#.....#...#...#...#...#...#...#.....#...###...#.#.....#.#...#.###...#...#...#.....#.#...#.#.#...#...#.....#.#
#.#################.#.###.#####.#.#####.#########.#.###.###.###.###.#.#####.#.#.#####.#.#.#.#.###.###.#####.#.###.#.###.#.#.###############.#
#.........#.........#...#.......#.###...#.........#...#.###...#.#...#.#...#.#...#.....#...#.#.#...#...#####...#...#.#...#...#.....#...#.....#
#########.#.###########.#########.###.###.###########.#.#####.#.#.###.#.#.#.#####.#########.#.#.###.###########.###.#.#######.###.#.#.#.#####
#.......#...#...#...#...#...#...#...#...#.........#...#.....#...#...#.#.#.#.....#...#...#...#...#...#...#...###.....#.#...#...###...#.#.#...#
#.#####.#####.#.#.#.#.###.#.#.#.###.###.#########.#.#######.#######.#.#.#.#####.###.#.#.#.#######.###.#.#.#.#########.#.#.#.#########.#.#.#.#
#.#...#.###...#...#...#...#...#...#.....#.........#.....#...###...#.#...#...###.#...#.#.#.....#...#...#.#.#...#...#...#.#...#.....#...#...#.#
#.#.#.#.###.###########.#########.#######.#############.#.#####.#.#.#######.###.#.###.#.#####.#.###.###.#.###.#.#.#.###.#####.###.#.#######.#
#...#.#.....#...#...#...###...###.......#.......#...#...#...#...#.#.......#.....#.#...#...###.#...#.#...#.#...#.#.#.#...#...#.#...#.#.....#.#
#####.#######.#.#.#.#.#####.#.#########.#######.#.#.#.#####.#.###.#######.#######.#.#####.###.###.#.#.###.#.###.#.#.#.###.#.#.#.###.#.###.#.#
###...#.......#...#...#...#.#.#.......#.#.......#.#.#.#.....#...#.###...#.#.......#.....#.....#...#.#...#.#.....#...#...#.#...#...#...###...#
###.###.###############.#.#.#.#.#####.#.#.#######.#.#.#.#######.#.###.#.#.#.###########.#######.###.###.#.#############.#.#######.###########
#...#...#.......#.......#.#.#.#...#...#.#.#...#...#.#.#.#.....#.#.#...#...#.....#...#...#.......###.#...#.#...........#...#.....#.....#.....#
#.###.###.#####.#.#######.#.#.###.#.###.#.#.#.#.###.#.#.#.###.#.#.#.###########.#.#.#.###.#########.#.###.#.#########.#####.###.#####.#.###.#
#...#.###.....#.#.......#...#.....#...#.#.#.#.#...#.#.#.#...#.#.#.#.......#.....#.#.#.#...#...#...#.#.#...#.........#.#.....###...#...#.#...#
###.#.#######.#.#######.#############.#.#.#.#.###.#.#.#.###.#.#.#.#######.#.#####.#.#.#.###.#.#.#.#.#.#.###########.#.#.#########.#.###.#.###
#...#.#.......#.......#...#.........#.#.#.#.#.#...#.#.#...#.#.#.#...#...#.#.#...#.#.#.#...#.#.#.#.#.#...#.....#...#.#.#.....#...#...#...#...#
#.###.#.#############.###.#.#######.#.#.#.#.#.#.###.#.###.#.#.#.###.#.#.#.#.#.#.#.#.#.###.#.#.#.#.#.#####.###.#.#.#.#.#####.#.#.#####.#####.#
#.....#.........#...#...#.#.###.....#...#.#.#.#...#.#...#.#.#.#...#.#.#.#.#.#.#.#.#.#.#...#.#.#.#.#.#...#...#...#...#.#...#.#.#...#...#.....#
###############.#.#.###.#.#.###.#########.#.#.###.#.###.#.#.#.###.#.#.#.#.#.#.#.#.#.#.#.###.#.#.#.#.#.#.###.#########.#.#.#.#.###.#.###.#####
#.....#.......#...#...#.#...#...#.......#...#...#.#.#...#...#...#.#...#...#.#.#.#.#.#.#...#.#.#.#.#.#.#.....#.......#...#...#.#...#.#...#...#
#.###.#.#####.#######.#.#####.###.#####.#######.#.#.#.#########.#.#########.#.#.#.#.#.###.#.#.#.#.#.#.#######.#####.#########.#.###.#.###.#.#
#...#.#.....#.#...#...#.......#...#.....#...###.#.#.#...###...#.#.........#.#.#...#...###...#.#.#.#.#.#.....#...#...#.....#...#.....#.....#.#
###.#.#####.#.#.#.#.###########.###.#####.#.###.#.#.###.###.#.#.#########.#.#.###############.#.#.#.#.#.###.###.#.###.###.#.###############.#
#...#.....#.#...#...#...#...#...###.......#...#.#.#.#...#...#...#...#.....#.#...#.............#.#.#.#...#...###.#...#...#.#.#.........#.....#
#.#######.#.#########.#.#.#.#.###############.#.#.#.#.###.#######.#.#.#####.###.#.#############.#.#.#####.#####.###.###.#.#.#.#######.#.#####
#.......#.#.....#...#.#...#.#.#.............#.#...#.#...#...#...#.#.#.....#...#.#.....#.....#...#.#.#.....#...#.#...#...#...#.......#...#...#
#######.#.#####.#.#.#.#####.#.#.###########.#.#####.###.###.#.#.#.#.#####.###.#.#####.#.###.#.###.#.#.#####.#.#.#.###.#############.#####.#.#
#.......#.......#.#...###...#.#.#.........#.#.#.....#...#...#.#.#.#.#.....###.#.#.....#.###...###...#.......#...#...#.#.............#...#.#.#
#.###############.#######.###.#.#.#######.#.#.#.#####.###.###.#.#.#.#.#######.#.#.#####.###########################.#.#.#############.#.#.#.#
#.........#.......#.....#.....#...#.......#...#.....#...#.#...#.#.#.#.###...#...#.....#.#.......#...#...............#.#.#...#...#.....#...#.#
#########.#.#######.###.###########.###############.###.#.#.###.#.#.#.###.#.#########.#.#.#####.#.#.#.###############.#.#.#.#.#.#.#########.#
#.........#.#.....#...#.###...###...#...#...###...#.....#...#...#.#.#.....#...#.......#.#.#...#.#.#.#.....#...#.......#...#...#...#.........#
#.#########.#.###.###.#.###.#.###.###.#.#.#.###.#.###########.###.#.#########.#.#######.#.#.#.#.#.#.#####.#.#.#.###################.#########
#...#...#...#...#.....#.....#...#.....#...#.....#.........###...#.#.#...#.....#.........#...#.#.#.#.#...#...#...#...#.........#...#.....#...#
###.#.#.#.#####.###############.#########################.#####.#.#.#.#.#.###################.#.#.#.#.#.#########.#.#.#######.#.#.#####.#.#.#
###...#.#.#.....#...#.........#.......#...........#.....#.....#.#.#...#.#.###.........#...#...#...#...#.......#...#...###...#...#.....#...#.#
#######.#.#.#####.#.#.#######.#######.#.#########.#.###.#####.#.#.#####.#.###.#######.#.#.#.#################.#.#########.#.#########.#####.#
#...#...#.#.....#.#.#.#.....#...#...#...###...###.#...#.#...#.#.#.#.....#.#...#.....#...#.#...#...#...#...###.#...........#.......###.....#.#
#.#.#.###.#####.#.#.#.#.###.###.#.#.#######.#.###.###.#.#.#.#.#.#.#.#####.#.###.###.#####.###.#.#.#.#.#.#.###.###################.#######.#.#
#.#.#.....#.....#.#.#.#...#.....#.#.........#...#.....#...#...#...#...#...#...#.#...#...#.....#.#.#.#...#...#.#...#.....#...#...#.....###.#.#
#.#.#######.#####.#.#.###.#######.#############.#####################.#.#####.#.#.###.#.#######.#.#.#######.#.#.#.#.###.#.#.#.#.#####.###.#.#
#.#.#...###.....#.#...###...#.....#.....#...#...#...#...#...#.......#...###...#.#...#.#.#.......#.#.#.......#...#.#...#.#.#.#.#.......#...#.#
#.#.#.#.#######.#.#########.#.#####.###.#.#.#.###.#.#.#.#.#.#.#####.#######.###.###.#.#.#.#######.#.#.###########.###.#.#.#.#.#########.###.#
#.#.#.#.#...###...#...#...#...###...###...#.#.....#...#...#...#.....#...#...#...#...#.#.#.###...#...#...........#...#.#...#.#...#.....#.#...#
#.#.#.#.#.#.#######.#.#.#.#######.#########.###################.#####.#.#.###.###.###.#.#.###.#.###############.###.#.#####.###.#.###.#.#.###
#.#...#...#.#...#...#...#...#...#.......###...#...#...#.........#.....#.#...#.###.....#...#...#.................###...#...#...#...#...#...###
#.#########.#.#.#.#########.#.#.#######.#####.#.#.#.#.#.#########.#####.###.#.#############.###########################.#.###.#####.#########
#.........#.#.#...#.....#...#.#.###.....#...#...#.#.#.#...#.....#.....#...#...#...#...#...#.............................#...#.#...#...#...###
#########.#.#.#####.###.#.###.#.###.#####.#.#####.#.#.###.#.###.#####.###.#####.#.#.#.#.#.#################################.#.#.#.###.#.#.###
#.......#.#.#.#.....#...#.....#.....###...#...###...#.....#...#...###.#...###...#...#...#.....#.....#...#.......#.....#.....#.#.#...#...#...#
#.#####.#.#.#.#.#####.#################.#####.###############.###.###.#.#####.###############.#.###.#.#.#.#####.#.###.#.#####.#.###.#######.#
#...#...#.#.#...#.....#.....#...........#...#...###...###...#...#.#...#.....#...............#.#...#...#.#.....#...###.#.....#...###...#.....#
###.#.###.#.#####.#####.###.#.###########.#.###.###.#.###.#.###.#.#.#######.###############.#.###.#####.#####.#######.#####.#########.#.#####
#...#...#.#.#...#.#...#...#.#.#...........#...#.....#...#.#.#...#...#.......#...............#.....#...#.......#.....#.......#...#...#...#...#
#.#####.#.#.#.#.#.#.#.###.#.#.#.#############.#########.#.#.#.#######.#######.#####################.#.#########.###.#########.#.#.#.#####.#.#
#.....#...#...#.#...#...#.#.#.#.....#...#...#.#...#...#...#.#.......#.#.....#.................#.....#.#...###...#...#...###...#...#.......#.#
#####.#########.#######.#.#.#.#####.#.#.#.#.#.#.#.#.#.#####.#######.#.#.###.#################.#.#####.#.#.###.###.###.#.###.###############.#
#...#.........#.#...###...#...#...#...#.#.#.#...#...#.#.....#.......#...#...#.....#...#.......#...#...#.#...#.#...###.#...#.#...............#
#.#.#########.#.#.#.###########.#.#####.#.#.#########.#.#####.###########.###.###.#.#.#.#########.#.###.###.#.#.#####.###.#.#.###############
#.#...........#...#.#...###...#.#.....#...#...###...#.#.....#.....#.....#.###...#...#.#.#...#.....#...#.#...#.#.#...#.#...#.#.......###...###
#.#################.#.#.###.#.#.#####.#######.###.#.#.#####.#####.#.###.#.#####.#####.#.#.#.#.#######.#.#.###.#.#.#.#.#.###.#######.###.#.###
#...#...#...#.....#...#.#...#.#.....#.......#...#.#.#.......###...#...#...#.....#...#.#...#...###...#...#.#...#...#...#.....#.....#.....#...#
###.#.#.#.#.#.###.#####.#.###.#####.#######.###.#.#.###########.#####.#####.#####.#.#.###########.#.#####.#.#################.###.#########.#
###...#...#...###.#...#.#...#.....#.......#...#.#.#...#.....#...#.....#...#.......#.#.#.......#...#.......#.#.........#...#...###...........#
#################.#.#.#.###.#####.#######.###.#.#.###.#.###.#.###.#####.#.#########.#.#.#####.#.###########.#.#######.#.#.#.#################
#.................#.#.#...#.....#.........#...#...#...#.#...#...#.#...#.#...#...#...#...#.....#.............#.......#...#.#...#...#...#...###
#.#################.#.###.#####.###########.#######.###.#.#####.#.#.#.#.###.#.#.#.#######.#########################.#####.###.#.#.#.#.#.#.###
#...................#...#.#...#...........#.....#...#...#...###.#.#.#.#...#.#.#.#.......#...#...#...#.......#.......#...#.....#.#...#...#...#
#######################.#.#.#.###########.#####.#.###.#####.###.#.#.#.###.#.#.#.#######.###.#.#.#.#.#.#####.#.#######.#.#######.###########.#
#...###.................#...#.............#.....#.....#.....#...#...#...#.#.#.#.###...#...#.#.#...#...#...#...#...###.#.#.....#.#.......#...#
#.#.###.###################################.###########.#####.#########.#.#.#.#.###.#.###.#.#.#########.#.#####.#.###.#.#.###.#.#.#####.#.###
#.#.....#.........#...#.....#...........###.............#...#.......#...#.#.#.#.#...#...#.#.#.#.......#.#.....#.#...#.#.#...#...#.....#.#...#
#.#######.#######.#.#.#.###.#.#########.#################.#.#######.#.###.#.#.#.#.#####.#.#.#.#.#####.#.#####.#.###.#.#.###.#########.#.###.#
#.........#.......#.#.#.#...#.#.........#.....#...###.....#.#######.#...#.#.#.#.#.....#.#.#.#...#...#.#.#...#...#...#.#.###.#.........#...#.#
###########.#######.#.#.#.###.#.#########.###.#.#.###.#####.#######.###.#.#.#.#.#####.#.#.#.#####.#.#.#.#.#.#####.###.#.###.#.###########.#.#
#...###.....#...#...#...#.....#.....#...#.#...#.#...#...#...#####...#...#.#.#.#.#.....#...#.....#.#.#.#.#.#.......###.#.#...#.....#.....#...#
#.#.###.#####.#.#.#################.#.#.#.#.###.###.###.#.#######.###.###.#.#.#.#.#############.#.#.#.#.#.###########.#.#.#######.#.###.#####
#.#.#...#...#.#.#.#.............###...#...#...#...#...#.#...#####..S#...#.#...#.#.#.......#.....#.#.#...#...#.........#...#...#...#.#...#...#
#.#.#.###.#.#.#.#.#.###########.#############.###.###.#.###.###########.#.#####.#.#.#####.#.#####.#.#######.#.#############.#.#.###.#.###.#.#
#.#...#...#...#...#...........#.#.............###...#.#.#...#########...#.....#.#...#...#.#.###...#...#.....#.#.....#.....#.#.#.....#.....#.#
#.#####.#####################.#.#.#################.#.#.#.###########.#######.#.#####.#.#.#.###.#####.#.#####.#.###.#.###.#.#.#############.#
#...#...#.....................#.#...#.....#.....#...#.#.#...#########.#...#...#.....#.#.#.#...#.....#.#.......#...#...###...#...............#
###.#.###.#####################.###.#.###.#.###.#.###.#.###.#########.#.#.#.#######.#.#.#.###.#####.#.###########.###########################
#...#.###...........#...#.....#.....#.#...#.#...#.#...#.#...#########.#.#.#.....#...#.#.#.#...#...#.#.###...#...#.....#...#.................#
#.###.#############.#.#.#.###.#######.#.###.#.###.#.###.#.###########.#.#.#####.#.###.#.#.#.###.#.#.#.###.#.#.#.#####.#.#.#.###############.#
#...#...#.......###...#...#...#.....#.#...#.#...#.#.#...#.###########.#.#.....#.#...#.#.#.#.#...#.#.#...#.#.#.#.#...#...#...#.....#...#.....#
###.###.#.#####.###########.###.###.#.###.#.###.#.#.#.###.###########.#.#####.#.###.#.#.#.#.#.###.#.###.#.#.#.#.#.#.#########.###.#.#.#.#####
###.....#.....#.#.......###.#...#...#.#...#...#...#.#.#...#########...#.#.....#...#.#.#.#.#.#...#...###.#.#.#.#.#.#...#.......#...#.#...#...#
#############.#.#.#####.###.#.###.###.#.#####.#####.#.#.###########.###.#.#######.#.#.#.#.#.###.#######.#.#.#.#.#.###.#.#######.###.#####.#.#
#.........#...#...#...#.....#...#.....#.#.....###...#.#...#########.....#.#...#...#...#.#.#...#...#.....#.#...#...#...#.....###...#.......#.#
#.#######.#.#######.#.#########.#######.#.#######.###.###.###############.#.#.#.#######.#.###.###.#.#####.#########.#######.#####.#########.#
#.......#.#...#.....#.....#.....#.......#.......#...#.#...###########.....#.#.#.#.......#...#...#.#.....#.........#...#...#.....#.#.....#...#
#######.#.###.#.#########.#.#####.#############.###.#.#.#############.#####.#.#.#.#########.###.#.#####.#########.###.#.#.#####.#.#.###.#.###
###.....#.....#.#.........#.#.....#.....#.......###.#.#...###########.....#.#...#.#...#...#...#...#.....#.........#...#.#.#.....#.#.###.#...#
###.###########.#.#########.#.#####.###.#.#########.#.###.###############.#.#####.#.#.#.#.###.#####.#####.#########.###.#.#.#####.#.###.###.#
#...#.....#...#.#...#...#...#.....#.###.#.###.....#...###.###.....#.......#...#...#.#.#.#.#...#...#.....#...#...#...#...#.#.....#.#...#.#...#
#.###.###.#.#.#.###.#.#.#.#######.#.###.#.###.###.#######.###.###.#.#########.#.###.#.#.#.#.###.#.#####.###.#.#.#.###.###.#####.#.###.#.#.###
#...#...#...#...###...#.#.###.....#.#...#...#...#...#...#.#E#.#...#...#...#...#...#.#...#.#.#...#.......#...#.#.#.#...###.#...#.#.#...#...###
###.###.###############.#.###.#####.#.#####.###.###.#.#.#.#.#.#.#####.#.#.#.#####.#.#####.#.#.###########.###.#.#.#.#####.#.#.#.#.#.#########
###.....#...#...###...#.#.#...#...#.#.#...#.....#...#.#...#...#.#...#...#.#.#.....#.#.....#.#.......#...#.....#.#.#.....#...#...#.#.........#
#########.#.#.#.###.#.#.#.#.###.#.#.#.#.#.#######.###.#########.#.#.#####.#.#.#####.#.#####.#######.#.#.#######.#.#####.#########.#########.#
###.......#...#.....#...#.#...#.#.#.#...#.#.....#.###.....#...#...#...###...#.....#.#.#...#.#.......#.#...#.....#.#.....#.......#.#...#.....#
###.#####################.###.#.#.#.#####.#.###.#.#######.#.#.#######.###########.#.#.#.#.#.#.#######.###.#.#####.#.#####.#####.#.#.#.#.#####
#...#.......#...#.....#...#...#.#...###...#...#...#.......#.#...#...#...........#...#...#.#.#.#...#...#...#.....#.#.......#...#.#.#.#.#.#...#
#.###.#####.#.#.#.###.#.###.###.#######.#####.#####.#######.###.#.#.###########.#########.#.#.#.#.#.###.#######.#.#########.#.#.#.#.#.#.#.#.#
#...#.#...#.#.#...###.#.#...#...#.......#...#.....#.....#...#...#.#.#...#...#...###...#...#.#.#.#.#.###.#...#...#.......#...#.#.#...#.#...#.#
###.#.#.#.#.#.#######.#.#.###.###.#######.#.#####.#####.#.###.###.#.#.#.#.#.#.#####.#.#.###.#.#.#.#.###.#.#.#.#########.#.###.#.#####.#####.#
#...#.#.#...#.###.....#.#.....#...#.....#.#.#.....#.....#.###.....#.#.#...#...#.....#...#...#.#.#.#...#...#.#.......###...###...#.....#...#.#
#.###.#.#####.###.#####.#######.###.###.#.#.#.#####.#####.#########.#.#########.#########.###.#.#.###.#####.#######.#############.#####.#.#.#
#...#.#...#...#...#.....###.....#...#...#.#.#.....#.#...#.........#.#...###...#.......#...#...#.#...#.#.....#...#...#.......#...#...#...#...#
###.#.###.#.###.###.#######.#####.###.###.#.#####.#.#.#.#########.#.###.###.#.#######.#.###.###.###.#.#.#####.#.#.###.#####.#.#.###.#.#######
#...#...#.#.#...#...#.......#...#...#.....#...#...#.#.#...#.....#.#...#...#.#...#.....#...#.#...###...#...#...#.#.....#...#...#...#.#.###...#
#.#####.#.#.#.###.###.#######.#.###.#########.#.###.#.###.#.###.#.###.###.#.###.#.#######.#.#.###########.#.###.#######.#.#######.#.#.###.#.#
#...#...#.#.#...#...#.....#...#.#...###...###.#...#.#.#...#.###.#...#...#...#...#.#.....#.#...###.........#...#...#.....#.....#...#.#.....#.#
###.#.###.#.###.###.#####.#.###.#.#####.#.###.###.#.#.#.###.###.###.###.#####.###.#.###.#.#######.###########.###.#.#########.#.###.#######.#
#...#...#.#.#...#...#.....#.###.#.#.....#.....#...#.#.#...#...#...#.#...#...#.###...###.#...#...#.......#.....#...#.........#.#...#...#...#.#
#.#####.#.#.#.###.###.#####.###.#.#.###########.###.#.###.###.###.#.#.###.#.#.#########.###.#.#.#######.#.#####.###########.#.###.###.#.#.#.#
#.#...#.#.#.#...#.#...#...#.#...#.#.#...#...#...#...#...#...#...#.#.#...#.#.#.........#.#...#.#.........#.....#...#...#...#.#.#...#...#.#.#.#
#.#.#.#.#.#.###.#.#.###.#.#.#.###.#.#.#.#.#.#.###.#####.###.###.#.#.###.#.#.#########.#.#.###.###############.###.#.#.#.#.#.#.#.###.###.#.#.#
#...#...#...###...#.....#...#.....#...#...#...###.......###.....#...###...#...........#...###.................###...#...#...#...###.....#...#
#############################################################################################################################################

118
20/main.rb Executable file
View file

@ -0,0 +1,118 @@
#!/usr/bin/env ruby
require "debug"
input = (ARGV.first.nil? ? DATA : ARGF)
.readlines(chomp: true)
.map(&:chars)
class PriorityQueue < Array
alias_method :extract_min, :shift
def <<(v)
super
sort_by!(&:last)
end
end
def unbounded?(graph, node)
node.first < 0 ||
node.last < 0 ||
node.first >= graph.size ||
node.last >= graph.first.size
end
def dijkstra(graph, source, target)
queue = PriorityQueue.new
dist = Hash.new
prev = Hash.new
queue << [source, 0]
dist[source] = 0
prev[source] = nil
until queue.empty?
node, picoseconds = queue.extract_min
[[0, 1], [0, -1], [1, 0], [-1, 0]]
.map { |dx, dy| [node.first + dx, node.last + dy] }
.reject { unbounded?(graph, _1) }
.each do |neighbor|
next if graph.dig(*neighbor) == "#"
if dist[neighbor].nil? || picoseconds + 1 < dist[neighbor]
dist[neighbor] = picoseconds + 1
prev[neighbor] = node
queue << [neighbor, picoseconds + 1]
end
end
end
path = Array.new
u = target
while prev[u]
path.unshift(u)
u = prev[u]
end
return dist, prev, path
end
def find_cheats(graph, dist, path, finish)
cheats = Hash.new
path.each do |node|
[[0, 2], [0, -2], [2, 0], [-2, 0]]
.map { |dx, dy| [node.first + dx, node.last + dy] }
.reject { unbounded?(graph, _1) }
.each do |neighbor|
next if graph.dig(*neighbor) == "#"
next if dist[node] >= dist[neighbor]
cheats[[node, neighbor]] = dist[neighbor] - dist[node] - 2
end
end
return cheats
end
def manhattan_distance(node1, node2)
(node1.first - node2.first).abs + (node1.last - node2.last).abs
end
def discover(char, graph)
(0...graph.size).each do |x|
(0...graph.first.size).each do |y|
return [x, y] if char == graph.dig(x, y)
end
end
end
start = discover("S", input)
finish = discover("E", input)
dist, prev, path = dijkstra(input, start, finish)
p find_cheats(input, dist, [start] + path, finish)
.values.tally.select { _1 >= 100 }.values.sum
p dist.keys.combination(2)
.select { manhattan_distance(_1, _2) <= 20 }
.count { dist[_2] - dist[_1] >= manhattan_distance(_1, _2) + 100 }
__END__
###############
#...#...#.....#
#.#.#.#.#.###.#
#S#...#.#.#...#
#######.#.#.###
#######.#.#...#
#######.#.###.#
###..E#...#...#
###.#######.###
#...###...#...#
#.#####.#.###.#
#.#...#.#.#...#
#.#.#.#.#.#.###
#...#...#...###
###############

2332
22/input Normal file

File diff suppressed because it is too large Load diff

53
22/main.rb Executable file
View file

@ -0,0 +1,53 @@
#!/usr/bin/env ruby
require "debug"
input = (ARGV.first.nil? ? DATA : ARGF)
.readlines(chomp: true)
.map(&:to_i)
def evolve(secret)
a = ((secret * 64) ^ secret) % 16777216
b = ((a / 32) ^ a) % 16777216
c = ((b * 2048) ^ b) % 16777216
end
part_1 = input.map do |secret|
original = secret
2000.times { secret = evolve(secret) }
secret
end.sum
p part_1
sequences = input.map do |secret|
secrets = 2000.times
.map { secret = evolve(secret) }
prices = secrets.map { _1.digits.first }
changes = prices
.map.with_index { |p, i| i == 0 ? 0 : p - prices[i - 1] }
sequences = Hash.new
changes[1..].each_cons(4).with_index.each do |sequence, i|
sequences[sequence] ||= prices[i + 4]
end
sequences
end
unique_sequences = sequences.flat_map(&:keys).uniq
part_2 = unique_sequences.map do |sequence|
sequences.sum { _1.fetch(sequence, 0) }
end.max
p part_2
__END__
1
10
100
2024