|
| 1 | +--- Day 15: Chiton --- |
| 2 | + |
| 3 | +You've almost reached the exit of the cave, but the walls are getting closer together. Your submarine can barely still fit, though; the main problem is that the walls of the cave are covered in chitons, and it would be best not to bump any of them. |
| 4 | + |
| 5 | +The cavern is large, but has a very low ceiling, restricting your motion to two dimensions. The shape of the cavern resembles a square; a quick scan of chiton density produces a map of risk level throughout the cave (your puzzle input). For example: |
| 6 | + |
| 7 | +1163751742 |
| 8 | +1381373672 |
| 9 | +2136511328 |
| 10 | +3694931569 |
| 11 | +7463417111 |
| 12 | +1319128137 |
| 13 | +1359912421 |
| 14 | +3125421639 |
| 15 | +1293138521 |
| 16 | +2311944581 |
| 17 | + |
| 18 | +You start in the top left position, your destination is the bottom right position, and you cannot move diagonally. The number at each position is its risk level; to determine the total risk of an entire path, add up the risk levels of each position you enter (that is, don't count the risk level of your starting position unless you enter it; leaving it adds no risk to your total). |
| 19 | + |
| 20 | +Your goal is to find a path with the lowest total risk. In this example, a path with the lowest total risk is highlighted here: |
| 21 | + |
| 22 | +1163751742 |
| 23 | +1381373672 |
| 24 | +2136511328 |
| 25 | +3694931569 |
| 26 | +7463417111 |
| 27 | +1319128137 |
| 28 | +1359912421 |
| 29 | +3125421639 |
| 30 | +1293138521 |
| 31 | +2311944581 |
| 32 | + |
| 33 | +The total risk of this path is 40 (the starting position is never entered, so its risk is not counted). |
| 34 | + |
| 35 | +What is the lowest total risk of any path from the top left to the bottom right? |
| 36 | + |
| 37 | +Your puzzle answer was 390. |
| 38 | + |
| 39 | +--- Part Two --- |
| 40 | + |
| 41 | +Now that you know how to find low-risk paths in the cave, you can try to find your way out. |
| 42 | + |
| 43 | +The entire cave is actually five times larger in both dimensions than you thought; the area you originally scanned is just one tile in a 5x5 tile area that forms the full map. Your original map tile repeats to the right and downward; each time the tile repeats to the right or downward, all of its risk levels are 1 higher than the tile immediately up or left of it. However, risk levels above 9 wrap back around to 1. So, if your original map had some position with a risk level of 8, then that same position on each of the 25 total tiles would be as follows: |
| 44 | + |
| 45 | +8 9 1 2 3 |
| 46 | +9 1 2 3 4 |
| 47 | +1 2 3 4 5 |
| 48 | +2 3 4 5 6 |
| 49 | +3 4 5 6 7 |
| 50 | + |
| 51 | +Each single digit above corresponds to the example position with a value of 8 on the top-left tile. Because the full map is actually five times larger in both dimensions, that position appears a total of 25 times, once in each duplicated tile, with the values shown above. |
| 52 | + |
| 53 | +Here is the full five-times-as-large version of the first example above, with the original map in the top left corner highlighted: |
| 54 | + |
| 55 | +11637517422274862853338597396444961841755517295286 |
| 56 | +13813736722492484783351359589446246169155735727126 |
| 57 | +21365113283247622439435873354154698446526571955763 |
| 58 | +36949315694715142671582625378269373648937148475914 |
| 59 | +74634171118574528222968563933317967414442817852555 |
| 60 | +13191281372421239248353234135946434524615754563572 |
| 61 | +13599124212461123532357223464346833457545794456865 |
| 62 | +31254216394236532741534764385264587549637569865174 |
| 63 | +12931385212314249632342535174345364628545647573965 |
| 64 | +23119445813422155692453326671356443778246755488935 |
| 65 | +22748628533385973964449618417555172952866628316397 |
| 66 | +24924847833513595894462461691557357271266846838237 |
| 67 | +32476224394358733541546984465265719557637682166874 |
| 68 | +47151426715826253782693736489371484759148259586125 |
| 69 | +85745282229685639333179674144428178525553928963666 |
| 70 | +24212392483532341359464345246157545635726865674683 |
| 71 | +24611235323572234643468334575457944568656815567976 |
| 72 | +42365327415347643852645875496375698651748671976285 |
| 73 | +23142496323425351743453646285456475739656758684176 |
| 74 | +34221556924533266713564437782467554889357866599146 |
| 75 | +33859739644496184175551729528666283163977739427418 |
| 76 | +35135958944624616915573572712668468382377957949348 |
| 77 | +43587335415469844652657195576376821668748793277985 |
| 78 | +58262537826937364893714847591482595861259361697236 |
| 79 | +96856393331796741444281785255539289636664139174777 |
| 80 | +35323413594643452461575456357268656746837976785794 |
| 81 | +35722346434683345754579445686568155679767926678187 |
| 82 | +53476438526458754963756986517486719762859782187396 |
| 83 | +34253517434536462854564757396567586841767869795287 |
| 84 | +45332667135644377824675548893578665991468977611257 |
| 85 | +44961841755517295286662831639777394274188841538529 |
| 86 | +46246169155735727126684683823779579493488168151459 |
| 87 | +54698446526571955763768216687487932779859814388196 |
| 88 | +69373648937148475914825958612593616972361472718347 |
| 89 | +17967414442817852555392896366641391747775241285888 |
| 90 | +46434524615754563572686567468379767857948187896815 |
| 91 | +46833457545794456865681556797679266781878137789298 |
| 92 | +64587549637569865174867197628597821873961893298417 |
| 93 | +45364628545647573965675868417678697952878971816398 |
| 94 | +56443778246755488935786659914689776112579188722368 |
| 95 | +55172952866628316397773942741888415385299952649631 |
| 96 | +57357271266846838237795794934881681514599279262561 |
| 97 | +65719557637682166874879327798598143881961925499217 |
| 98 | +71484759148259586125936169723614727183472583829458 |
| 99 | +28178525553928963666413917477752412858886352396999 |
| 100 | +57545635726865674683797678579481878968159298917926 |
| 101 | +57944568656815567976792667818781377892989248891319 |
| 102 | +75698651748671976285978218739618932984172914319528 |
| 103 | +56475739656758684176786979528789718163989182927419 |
| 104 | +67554889357866599146897761125791887223681299833479 |
| 105 | + |
| 106 | +Equipped with the full map, you can now find a path from the top left corner to the bottom right corner with the lowest total risk: |
| 107 | + |
| 108 | +11637517422274862853338597396444961841755517295286 |
| 109 | +13813736722492484783351359589446246169155735727126 |
| 110 | +21365113283247622439435873354154698446526571955763 |
| 111 | +36949315694715142671582625378269373648937148475914 |
| 112 | +74634171118574528222968563933317967414442817852555 |
| 113 | +13191281372421239248353234135946434524615754563572 |
| 114 | +13599124212461123532357223464346833457545794456865 |
| 115 | +31254216394236532741534764385264587549637569865174 |
| 116 | +12931385212314249632342535174345364628545647573965 |
| 117 | +23119445813422155692453326671356443778246755488935 |
| 118 | +22748628533385973964449618417555172952866628316397 |
| 119 | +24924847833513595894462461691557357271266846838237 |
| 120 | +32476224394358733541546984465265719557637682166874 |
| 121 | +47151426715826253782693736489371484759148259586125 |
| 122 | +85745282229685639333179674144428178525553928963666 |
| 123 | +24212392483532341359464345246157545635726865674683 |
| 124 | +24611235323572234643468334575457944568656815567976 |
| 125 | +42365327415347643852645875496375698651748671976285 |
| 126 | +23142496323425351743453646285456475739656758684176 |
| 127 | +34221556924533266713564437782467554889357866599146 |
| 128 | +33859739644496184175551729528666283163977739427418 |
| 129 | +35135958944624616915573572712668468382377957949348 |
| 130 | +43587335415469844652657195576376821668748793277985 |
| 131 | +58262537826937364893714847591482595861259361697236 |
| 132 | +96856393331796741444281785255539289636664139174777 |
| 133 | +35323413594643452461575456357268656746837976785794 |
| 134 | +35722346434683345754579445686568155679767926678187 |
| 135 | +53476438526458754963756986517486719762859782187396 |
| 136 | +34253517434536462854564757396567586841767869795287 |
| 137 | +45332667135644377824675548893578665991468977611257 |
| 138 | +44961841755517295286662831639777394274188841538529 |
| 139 | +46246169155735727126684683823779579493488168151459 |
| 140 | +54698446526571955763768216687487932779859814388196 |
| 141 | +69373648937148475914825958612593616972361472718347 |
| 142 | +17967414442817852555392896366641391747775241285888 |
| 143 | +46434524615754563572686567468379767857948187896815 |
| 144 | +46833457545794456865681556797679266781878137789298 |
| 145 | +64587549637569865174867197628597821873961893298417 |
| 146 | +45364628545647573965675868417678697952878971816398 |
| 147 | +56443778246755488935786659914689776112579188722368 |
| 148 | +55172952866628316397773942741888415385299952649631 |
| 149 | +57357271266846838237795794934881681514599279262561 |
| 150 | +65719557637682166874879327798598143881961925499217 |
| 151 | +71484759148259586125936169723614727183472583829458 |
| 152 | +28178525553928963666413917477752412858886352396999 |
| 153 | +57545635726865674683797678579481878968159298917926 |
| 154 | +57944568656815567976792667818781377892989248891319 |
| 155 | +75698651748671976285978218739618932984172914319528 |
| 156 | +56475739656758684176786979528789718163989182927419 |
| 157 | +67554889357866599146897761125791887223681299833479 |
| 158 | + |
| 159 | +The total risk of this path is 315 (the starting position is still never entered, so its risk is not counted). |
| 160 | + |
| 161 | +Using the full map, what is the lowest total risk of any path from the top left to the bottom right? |
| 162 | + |
| 163 | +Your puzzle answer was 2814. |
0 commit comments