main^2
Yanick Champoux 2022-12-14 10:40:00 -05:00
parent 80fdc317e8
commit 7e02f06f23
7 changed files with 477 additions and 0 deletions

148
2022/14/input Normal file
View File

@ -0,0 +1,148 @@
481,122 -> 481,125 -> 476,125 -> 476,129 -> 491,129 -> 491,125 -> 485,125 -> 485,122
475,119 -> 475,113 -> 475,119 -> 477,119 -> 477,113 -> 477,119 -> 479,119 -> 479,114 -> 479,119 -> 481,119 -> 481,115 -> 481,119 -> 483,119 -> 483,113 -> 483,119
489,148 -> 493,148
471,152 -> 475,152
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
492,60 -> 492,63 -> 486,63 -> 486,71 -> 502,71 -> 502,63 -> 496,63 -> 496,60
504,158 -> 504,162 -> 503,162 -> 503,170 -> 511,170 -> 511,162 -> 507,162 -> 507,158
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
486,146 -> 490,146
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
475,119 -> 475,113 -> 475,119 -> 477,119 -> 477,113 -> 477,119 -> 479,119 -> 479,114 -> 479,119 -> 481,119 -> 481,115 -> 481,119 -> 483,119 -> 483,113 -> 483,119
504,158 -> 504,162 -> 503,162 -> 503,170 -> 511,170 -> 511,162 -> 507,162 -> 507,158
518,31 -> 518,35 -> 517,35 -> 517,38 -> 529,38 -> 529,35 -> 522,35 -> 522,31
490,100 -> 495,100
481,122 -> 481,125 -> 476,125 -> 476,129 -> 491,129 -> 491,125 -> 485,125 -> 485,122
500,141 -> 505,141
499,84 -> 499,80 -> 499,84 -> 501,84 -> 501,77 -> 501,84 -> 503,84 -> 503,75 -> 503,84 -> 505,84 -> 505,83 -> 505,84
475,119 -> 475,113 -> 475,119 -> 477,119 -> 477,113 -> 477,119 -> 479,119 -> 479,114 -> 479,119 -> 481,119 -> 481,115 -> 481,119 -> 483,119 -> 483,113 -> 483,119
518,31 -> 518,35 -> 517,35 -> 517,38 -> 529,38 -> 529,35 -> 522,35 -> 522,31
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
495,57 -> 499,57
489,133 -> 489,134 -> 494,134
488,106 -> 493,106
519,57 -> 523,57
481,122 -> 481,125 -> 476,125 -> 476,129 -> 491,129 -> 491,125 -> 485,125 -> 485,122
493,141 -> 498,141
504,54 -> 508,54
494,97 -> 494,92 -> 494,97 -> 496,97 -> 496,91 -> 496,97 -> 498,97 -> 498,88 -> 498,97 -> 500,97 -> 500,94 -> 500,97
474,150 -> 478,150
494,97 -> 494,92 -> 494,97 -> 496,97 -> 496,91 -> 496,97 -> 498,97 -> 498,88 -> 498,97 -> 500,97 -> 500,94 -> 500,97
498,54 -> 502,54
489,139 -> 494,139
518,31 -> 518,35 -> 517,35 -> 517,38 -> 529,38 -> 529,35 -> 522,35 -> 522,31
510,41 -> 510,42 -> 521,42 -> 521,41
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
480,150 -> 484,150
494,97 -> 494,92 -> 494,97 -> 496,97 -> 496,91 -> 496,97 -> 498,97 -> 498,88 -> 498,97 -> 500,97 -> 500,94 -> 500,97
518,31 -> 518,35 -> 517,35 -> 517,38 -> 529,38 -> 529,35 -> 522,35 -> 522,31
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
494,97 -> 494,92 -> 494,97 -> 496,97 -> 496,91 -> 496,97 -> 498,97 -> 498,88 -> 498,97 -> 500,97 -> 500,94 -> 500,97
504,158 -> 504,162 -> 503,162 -> 503,170 -> 511,170 -> 511,162 -> 507,162 -> 507,158
501,51 -> 505,51
504,158 -> 504,162 -> 503,162 -> 503,170 -> 511,170 -> 511,162 -> 507,162 -> 507,158
498,104 -> 503,104
477,148 -> 481,148
510,48 -> 514,48
475,119 -> 475,113 -> 475,119 -> 477,119 -> 477,113 -> 477,119 -> 479,119 -> 479,114 -> 479,119 -> 481,119 -> 481,115 -> 481,119 -> 483,119 -> 483,113 -> 483,119
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
475,119 -> 475,113 -> 475,119 -> 477,119 -> 477,113 -> 477,119 -> 479,119 -> 479,114 -> 479,119 -> 481,119 -> 481,115 -> 481,119 -> 483,119 -> 483,113 -> 483,119
483,152 -> 487,152
492,60 -> 492,63 -> 486,63 -> 486,71 -> 502,71 -> 502,63 -> 496,63 -> 496,60
475,119 -> 475,113 -> 475,119 -> 477,119 -> 477,113 -> 477,119 -> 479,119 -> 479,114 -> 479,119 -> 481,119 -> 481,115 -> 481,119 -> 483,119 -> 483,113 -> 483,119
494,97 -> 494,92 -> 494,97 -> 496,97 -> 496,91 -> 496,97 -> 498,97 -> 498,88 -> 498,97 -> 500,97 -> 500,94 -> 500,97
492,60 -> 492,63 -> 486,63 -> 486,71 -> 502,71 -> 502,63 -> 496,63 -> 496,60
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
516,54 -> 520,54
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
475,119 -> 475,113 -> 475,119 -> 477,119 -> 477,113 -> 477,119 -> 479,119 -> 479,114 -> 479,119 -> 481,119 -> 481,115 -> 481,119 -> 483,119 -> 483,113 -> 483,119
494,102 -> 499,102
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
504,158 -> 504,162 -> 503,162 -> 503,170 -> 511,170 -> 511,162 -> 507,162 -> 507,158
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
518,31 -> 518,35 -> 517,35 -> 517,38 -> 529,38 -> 529,35 -> 522,35 -> 522,31
494,97 -> 494,92 -> 494,97 -> 496,97 -> 496,91 -> 496,97 -> 498,97 -> 498,88 -> 498,97 -> 500,97 -> 500,94 -> 500,97
513,51 -> 517,51
492,60 -> 492,63 -> 486,63 -> 486,71 -> 502,71 -> 502,63 -> 496,63 -> 496,60
481,122 -> 481,125 -> 476,125 -> 476,129 -> 491,129 -> 491,125 -> 485,125 -> 485,122
499,84 -> 499,80 -> 499,84 -> 501,84 -> 501,77 -> 501,84 -> 503,84 -> 503,75 -> 503,84 -> 505,84 -> 505,83 -> 505,84
518,31 -> 518,35 -> 517,35 -> 517,38 -> 529,38 -> 529,35 -> 522,35 -> 522,31
494,97 -> 494,92 -> 494,97 -> 496,97 -> 496,91 -> 496,97 -> 498,97 -> 498,88 -> 498,97 -> 500,97 -> 500,94 -> 500,97
489,133 -> 489,134 -> 494,134
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
507,57 -> 511,57
492,60 -> 492,63 -> 486,63 -> 486,71 -> 502,71 -> 502,63 -> 496,63 -> 496,60
504,158 -> 504,162 -> 503,162 -> 503,170 -> 511,170 -> 511,162 -> 507,162 -> 507,158
499,84 -> 499,80 -> 499,84 -> 501,84 -> 501,77 -> 501,84 -> 503,84 -> 503,75 -> 503,84 -> 505,84 -> 505,83 -> 505,84
475,119 -> 475,113 -> 475,119 -> 477,119 -> 477,113 -> 477,119 -> 479,119 -> 479,114 -> 479,119 -> 481,119 -> 481,115 -> 481,119 -> 483,119 -> 483,113 -> 483,119
477,152 -> 481,152
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
494,97 -> 494,92 -> 494,97 -> 496,97 -> 496,91 -> 496,97 -> 498,97 -> 498,88 -> 498,97 -> 500,97 -> 500,94 -> 500,97
480,146 -> 484,146
499,84 -> 499,80 -> 499,84 -> 501,84 -> 501,77 -> 501,84 -> 503,84 -> 503,75 -> 503,84 -> 505,84 -> 505,83 -> 505,84
510,54 -> 514,54
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
475,119 -> 475,113 -> 475,119 -> 477,119 -> 477,113 -> 477,119 -> 479,119 -> 479,114 -> 479,119 -> 481,119 -> 481,115 -> 481,119 -> 483,119 -> 483,113 -> 483,119
460,155 -> 474,155 -> 474,154
495,152 -> 499,152
492,60 -> 492,63 -> 486,63 -> 486,71 -> 502,71 -> 502,63 -> 496,63 -> 496,60
507,45 -> 511,45
499,27 -> 499,28 -> 519,28
495,106 -> 500,106
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
494,97 -> 494,92 -> 494,97 -> 496,97 -> 496,91 -> 496,97 -> 498,97 -> 498,88 -> 498,97 -> 500,97 -> 500,94 -> 500,97
510,41 -> 510,42 -> 521,42 -> 521,41
499,84 -> 499,80 -> 499,84 -> 501,84 -> 501,77 -> 501,84 -> 503,84 -> 503,75 -> 503,84 -> 505,84 -> 505,83 -> 505,84
492,60 -> 492,63 -> 486,63 -> 486,71 -> 502,71 -> 502,63 -> 496,63 -> 496,60
481,122 -> 481,125 -> 476,125 -> 476,129 -> 491,129 -> 491,125 -> 485,125 -> 485,122
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
504,48 -> 508,48
499,84 -> 499,80 -> 499,84 -> 501,84 -> 501,77 -> 501,84 -> 503,84 -> 503,75 -> 503,84 -> 505,84 -> 505,83 -> 505,84
492,150 -> 496,150
502,106 -> 507,106
486,150 -> 490,150
489,152 -> 493,152
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
481,122 -> 481,125 -> 476,125 -> 476,129 -> 491,129 -> 491,125 -> 485,125 -> 485,122
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
499,84 -> 499,80 -> 499,84 -> 501,84 -> 501,77 -> 501,84 -> 503,84 -> 503,75 -> 503,84 -> 505,84 -> 505,83 -> 505,84
492,137 -> 497,137
507,51 -> 511,51
504,158 -> 504,162 -> 503,162 -> 503,170 -> 511,170 -> 511,162 -> 507,162 -> 507,158
484,104 -> 489,104
494,97 -> 494,92 -> 494,97 -> 496,97 -> 496,91 -> 496,97 -> 498,97 -> 498,88 -> 498,97 -> 500,97 -> 500,94 -> 500,97
518,31 -> 518,35 -> 517,35 -> 517,38 -> 529,38 -> 529,35 -> 522,35 -> 522,31
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
460,155 -> 474,155 -> 474,154
487,102 -> 492,102
491,104 -> 496,104
481,122 -> 481,125 -> 476,125 -> 476,129 -> 491,129 -> 491,125 -> 485,125 -> 485,122
510,41 -> 510,42 -> 521,42 -> 521,41
475,119 -> 475,113 -> 475,119 -> 477,119 -> 477,113 -> 477,119 -> 479,119 -> 479,114 -> 479,119 -> 481,119 -> 481,115 -> 481,119 -> 483,119 -> 483,113 -> 483,119
483,148 -> 487,148
501,57 -> 505,57
496,139 -> 501,139
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
475,119 -> 475,113 -> 475,119 -> 477,119 -> 477,113 -> 477,119 -> 479,119 -> 479,114 -> 479,119 -> 481,119 -> 481,115 -> 481,119 -> 483,119 -> 483,113 -> 483,119
475,119 -> 475,113 -> 475,119 -> 477,119 -> 477,113 -> 477,119 -> 479,119 -> 479,114 -> 479,119 -> 481,119 -> 481,115 -> 481,119 -> 483,119 -> 483,113 -> 483,119
481,106 -> 486,106
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
475,119 -> 475,113 -> 475,119 -> 477,119 -> 477,113 -> 477,119 -> 479,119 -> 479,114 -> 479,119 -> 481,119 -> 481,115 -> 481,119 -> 483,119 -> 483,113 -> 483,119
475,119 -> 475,113 -> 475,119 -> 477,119 -> 477,113 -> 477,119 -> 479,119 -> 479,114 -> 479,119 -> 481,119 -> 481,115 -> 481,119 -> 483,119 -> 483,113 -> 483,119
499,84 -> 499,80 -> 499,84 -> 501,84 -> 501,77 -> 501,84 -> 503,84 -> 503,75 -> 503,84 -> 505,84 -> 505,83 -> 505,84
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
499,84 -> 499,80 -> 499,84 -> 501,84 -> 501,77 -> 501,84 -> 503,84 -> 503,75 -> 503,84 -> 505,84 -> 505,83 -> 505,84
490,23 -> 490,13 -> 490,23 -> 492,23 -> 492,17 -> 492,23 -> 494,23 -> 494,18 -> 494,23 -> 496,23 -> 496,22 -> 496,23 -> 498,23 -> 498,21 -> 498,23 -> 500,23 -> 500,18 -> 500,23 -> 502,23 -> 502,15 -> 502,23 -> 504,23 -> 504,22 -> 504,23 -> 506,23 -> 506,18 -> 506,23 -> 508,23 -> 508,19 -> 508,23
494,97 -> 494,92 -> 494,97 -> 496,97 -> 496,91 -> 496,97 -> 498,97 -> 498,88 -> 498,97 -> 500,97 -> 500,94 -> 500,97
486,141 -> 491,141
499,84 -> 499,80 -> 499,84 -> 501,84 -> 501,77 -> 501,84 -> 503,84 -> 503,75 -> 503,84 -> 505,84 -> 505,83 -> 505,84
499,27 -> 499,28 -> 519,28
499,84 -> 499,80 -> 499,84 -> 501,84 -> 501,77 -> 501,84 -> 503,84 -> 503,75 -> 503,84 -> 505,84 -> 505,83 -> 505,84
513,57 -> 517,57
483,144 -> 487,144

85
2022/14/part1.js Normal file
View File

@ -0,0 +1,85 @@
import * as R from "remeda";
import Victor from '@a-robu/victor';
import { readFile } from "../05/part1.js";
export const V = (...args) => new Victor(...args);
const parseLine = line => line.match(/[\d,]+/g).map( x => eval(`[${x}]`) );
const readInput = (...args) =>
R.pipe(
readFile(...args),
(lines) => lines.split("\n"),
R.compact, // remove last line
R.map( parseLine )
);
export const puzzleInput = readInput(import.meta.url, "input");
export const sample = readInput(import.meta.url, "sample");
export function genCave(rocks) {
const cave = {};
for( const rock of rocks ) {
const points = rock.map( Victor.fromArray );
let from = points.shift();
while( points.length ) {
/** @type Victor */
const to = points.shift();
const direction = to.clone().subtract(from).normalize();
R.times(to.clone().subtract(from).length()+1, () => {
if(!cave[from.y]) cave[from.y] = {};
cave[from.y][from.x] = '#';
from.add(direction);
});
from = to;
}
}
return cave;
}
function pourSand(cave){
cave = R.clone(cave);
let sand = 0;
/** @type Victor */
let current;
const maxDepth = R.pipe(
cave,
R.keys,
R.map( x => parseInt(x) ),
R.maxBy( R.identity ),
);
console.log({ maxDepth });
while(true) {
if(!current) current = V(500,0);
if( current.y > maxDepth ) return sand;
const next = [ [0,1],[-1,1],[1,1] ].map( args => V(...args) ).map(
v => v.add(current)
).find( v => ! (cave[v.y] && cave[v.y][v.x]) );
if( next ) {
current = next;
}
else {
if( ! cave[current.y] ) cave[current.y] = {};
cave[current.y][current.x] = 'o';
sand++;
current = null;
}
}
};
export default R.createPipe(
genCave,
pourSand,
)

52
2022/14/part2.js Normal file
View File

@ -0,0 +1,52 @@
import * as R from "remeda";
import { genCave, V } from './part1.js';
function pourSand(cave){
cave = R.clone(cave);
let sand = 0;
/** @type Victor */
let current;
const maxDepth = R.pipe(
cave,
R.keys,
R.map( x => parseInt(x) ),
R.maxBy( R.identity ),
) + 1;
while(true) {
if(!current) current = V(500,0);
if( current.y === maxDepth ) {
if( ! cave[current.y] ) cave[current.y] = {};
cave[current.y][current.x] = 'o';
sand++;
current = null;
continue;
}
const next = [ [0,1],[-1,1],[1,1] ].map( args => V(...args) ).map(
v => v.add(current)
).find( v => ! (cave[v.y] && cave[v.y][v.x]) );
if( next ) {
current = next;
}
else {
if( current.y === 0 ) return 1+sand;
if( ! cave[current.y] ) cave[current.y] = {};
cave[current.y][current.x] = 'o';
sand++;
current = null;
}
}
};
export default R.createPipe(
genCave,
pourSand,
)

153
2022/14/puzzle.md Normal file
View File

@ -0,0 +1,153 @@
\--- Day 14: Regolith Reservoir ---
----------
The distress signal leads you to a giant waterfall! Actually, hang on - the signal seems like it's coming from the waterfall itself, and that doesn't make any sense. However, you do notice a little path that leads *behind* the waterfall.
Correction: the distress signal leads you behind a giant waterfall! There seems to be a large cave system here, and the signal definitely leads further inside.
As you begin to make your way deeper underground, you feel the ground rumble for a moment. Sand begins pouring into the cave! If you don't quickly figure out where the sand is going, you could quickly become trapped!
Fortunately, your [familiarity](/2018/day/17) with analyzing the path of falling material will come in handy here. You scan a two-dimensional vertical slice of the cave above you (your puzzle input) and discover that it is mostly *air* with structures made of *rock*.
Your scan traces the path of each solid rock structure and reports the `x,y` coordinates that form the shape of the path, where `x` represents distance to the right and `y` represents distance down. Each path appears as a single line of text in your scan. After the first point of each path, each point indicates the end of a straight horizontal or vertical line to be drawn from the previous point. For example:
```
498,4 -> 498,6 -> 496,6
503,4 -> 502,4 -> 502,9 -> 494,9
```
This scan means that there are two paths of rock; the first path consists of two straight lines, and the second path consists of three straight lines. (Specifically, the first path consists of a line of rock from `498,4` through `498,6` and another line of rock from `498,6` through `496,6`.)
The sand is pouring into the cave from point `500,0`.
Drawing rock as `#`, air as `.`, and the source of the sand as `+`, this becomes:
```
4 5 5
9 0 0
4 0 3
0 ......+...
1 ..........
2 ..........
3 ..........
4 ....#...##
5 ....#...#.
6 ..###...#.
7 ........#.
8 ........#.
9 #########.
```
Sand is produced *one unit at a time*, and the next unit of sand is not produced until the previous unit of sand *comes to rest*. A unit of sand is large enough to fill one tile of air in your scan.
A unit of sand always falls *down one step* if possible. If the tile immediately below is blocked (by rock or sand), the unit of sand attempts to instead move diagonally *one step down and to the left*. If that tile is blocked, the unit of sand attempts to instead move diagonally *one step down and to the right*. Sand keeps moving as long as it is able to do so, at each step trying to move down, then down-left, then down-right. If all three possible destinations are blocked, the unit of sand *comes to rest* and no longer moves, at which point the next unit of sand is created back at the source.
So, drawing sand that has come to rest as `o`, the first unit of sand simply falls straight down and then stops:
```
......+...
..........
..........
..........
....#...##
....#...#.
..###...#.
........#.
......o.#.
#########.
```
The second unit of sand then falls straight down, lands on the first one, and then comes to rest to its left:
```
......+...
..........
..........
..........
....#...##
....#...#.
..###...#.
........#.
.....oo.#.
#########.
```
After a total of five units of sand have come to rest, they form this pattern:
```
......+...
..........
..........
..........
....#...##
....#...#.
..###...#.
......o.#.
....oooo#.
#########.
```
After a total of 22 units of sand:
```
......+...
..........
......o...
.....ooo..
....#ooo##
....#ooo#.
..###ooo#.
....oooo#.
...ooooo#.
#########.
```
Finally, only two more units of sand can possibly come to rest:
```
......+...
..........
......o...
.....ooo..
....#ooo##
...o#ooo#.
..###ooo#.
....oooo#.
.o.ooooo#.
#########.
```
Once all `*24*` units of sand shown above have come to rest, all further sand flows out the bottom, falling into the endless void. Just for fun, the path any new sand takes before falling forever is shown here with `~`:
```
.......+...
.......~...
......~o...
.....~ooo..
....~#ooo##
...~o#ooo#.
..~###ooo#.
..~..oooo#.
.~o.ooooo#.
~#########.
~..........
~..........
~..........
```
Using your scan, simulate the falling sand. *How many units of sand come to rest before sand starts flowing into the abyss below?*
To begin, [get your puzzle input](14/input).
Answer:
You can also [Shareon [Twitter](https://twitter.com/intent/tweet?text=%22Regolith+Reservoir%22+%2D+Day+14+%2D+Advent+of+Code+2022&url=https%3A%2F%2Fadventofcode%2Ecom%2F2022%2Fday%2F14&related=ericwastl&hashtags=AdventOfCode) [Mastodon](javascript:void(0);)] this puzzle.

2
2022/14/sample Normal file
View File

@ -0,0 +1,2 @@
498,4 -> 498,6 -> 496,6
503,4 -> 502,4 -> 502,9 -> 494,9

34
2022/14/test.js Normal file
View File

@ -0,0 +1,34 @@
import { test, expect, describe } from "vitest";
import { expectSolution } from "../01/main.js";
import part1, { genCave, sample, puzzleInput } from "./part1.js";
import part2 from "./part2.js";
describe("part 1", () => {
test("readInput", () => {
expect(sample).toEqual([
[[498,4], [498,6], [496,6]],
[[503,4 ], [ 502,4 ], [ 502,9 ], [ 494,9]],
])
});
test( 'genCave', () => {
expect( genCave(sample) ).toMatchObject({
4: { 498: '#' }
});
} )
test("sample", () => {
expect(part1(sample)).toEqual(24);
});
test("solution", () => {
expectSolution(part1(puzzleInput)).toEqual(832);
});
});
describe.only("part 2", () => {
test("sample", () => {
expect(part2(sample)).toEqual(93);
});
test("solution", () => {
expectSolution(part2(puzzleInput)).toEqual(27601);
});
});

View File

@ -19,5 +19,8 @@
"remeda": "^1.3.0",
"vite": "^4.0.1",
"vitest": "0.25.7"
},
"devDependencies": {
"@vitest/ui": "^0.25.8"
}
}