Compare commits
2 Commits
4efef42bc9
...
163029eaeb
Author | SHA1 | Date | |
---|---|---|---|
163029eaeb | |||
cd2d6f4452 |
7
day14/Cargo.lock
generated
Normal file
7
day14/Cargo.lock
generated
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "day14"
|
||||||
|
version = "0.1.0"
|
164
day14/input.txt
Normal file
164
day14/input.txt
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
513,69 -> 513,71 -> 511,71 -> 511,76 -> 522,76 -> 522,71 -> 517,71 -> 517,69
|
||||||
|
520,87 -> 524,87
|
||||||
|
480,121 -> 480,122 -> 498,122 -> 498,121
|
||||||
|
520,56 -> 520,60 -> 517,60 -> 517,66 -> 528,66 -> 528,60 -> 523,60 -> 523,56
|
||||||
|
484,147 -> 484,149 -> 483,149 -> 483,153 -> 489,153 -> 489,149 -> 488,149 -> 488,147
|
||||||
|
493,24 -> 498,24
|
||||||
|
496,22 -> 501,22
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
480,118 -> 480,111 -> 480,118 -> 482,118 -> 482,116 -> 482,118 -> 484,118 -> 484,111 -> 484,118 -> 486,118 -> 486,110 -> 486,118 -> 488,118 -> 488,117 -> 488,118
|
||||||
|
508,79 -> 512,79
|
||||||
|
486,104 -> 486,105 -> 493,105 -> 493,104
|
||||||
|
497,129 -> 502,129
|
||||||
|
474,34 -> 478,34
|
||||||
|
480,118 -> 480,111 -> 480,118 -> 482,118 -> 482,116 -> 482,118 -> 484,118 -> 484,111 -> 484,118 -> 486,118 -> 486,110 -> 486,118 -> 488,118 -> 488,117 -> 488,118
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
508,87 -> 512,87
|
||||||
|
512,53 -> 512,43 -> 512,53 -> 514,53 -> 514,48 -> 514,53 -> 516,53 -> 516,44 -> 516,53 -> 518,53 -> 518,50 -> 518,53 -> 520,53 -> 520,46 -> 520,53
|
||||||
|
499,20 -> 504,20
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
480,118 -> 480,111 -> 480,118 -> 482,118 -> 482,116 -> 482,118 -> 484,118 -> 484,111 -> 484,118 -> 486,118 -> 486,110 -> 486,118 -> 488,118 -> 488,117 -> 488,118
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
496,125 -> 501,125
|
||||||
|
512,53 -> 512,43 -> 512,53 -> 514,53 -> 514,48 -> 514,53 -> 516,53 -> 516,44 -> 516,53 -> 518,53 -> 518,50 -> 518,53 -> 520,53 -> 520,46 -> 520,53
|
||||||
|
511,26 -> 516,26
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
520,56 -> 520,60 -> 517,60 -> 517,66 -> 528,66 -> 528,60 -> 523,60 -> 523,56
|
||||||
|
520,56 -> 520,60 -> 517,60 -> 517,66 -> 528,66 -> 528,60 -> 523,60 -> 523,56
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
502,83 -> 506,83
|
||||||
|
496,87 -> 500,87
|
||||||
|
483,26 -> 488,26
|
||||||
|
487,131 -> 492,131
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
499,85 -> 503,85
|
||||||
|
480,34 -> 484,34
|
||||||
|
474,38 -> 478,38
|
||||||
|
486,104 -> 486,105 -> 493,105 -> 493,104
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
494,90 -> 494,92 -> 489,92 -> 489,100 -> 504,100 -> 504,92 -> 497,92 -> 497,90
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
513,69 -> 513,71 -> 511,71 -> 511,76 -> 522,76 -> 522,71 -> 517,71 -> 517,69
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
520,56 -> 520,60 -> 517,60 -> 517,66 -> 528,66 -> 528,60 -> 523,60 -> 523,56
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
480,38 -> 484,38
|
||||||
|
489,40 -> 493,40
|
||||||
|
483,36 -> 487,36
|
||||||
|
480,118 -> 480,111 -> 480,118 -> 482,118 -> 482,116 -> 482,118 -> 484,118 -> 484,111 -> 484,118 -> 486,118 -> 486,110 -> 486,118 -> 488,118 -> 488,117 -> 488,118
|
||||||
|
508,131 -> 513,131
|
||||||
|
517,85 -> 521,85
|
||||||
|
494,131 -> 499,131
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
512,53 -> 512,43 -> 512,53 -> 514,53 -> 514,48 -> 514,53 -> 516,53 -> 516,44 -> 516,53 -> 518,53 -> 518,50 -> 518,53 -> 520,53 -> 520,46 -> 520,53
|
||||||
|
494,90 -> 494,92 -> 489,92 -> 489,100 -> 504,100 -> 504,92 -> 497,92 -> 497,90
|
||||||
|
514,87 -> 518,87
|
||||||
|
512,53 -> 512,43 -> 512,53 -> 514,53 -> 514,48 -> 514,53 -> 516,53 -> 516,44 -> 516,53 -> 518,53 -> 518,50 -> 518,53 -> 520,53 -> 520,46 -> 520,53
|
||||||
|
512,53 -> 512,43 -> 512,53 -> 514,53 -> 514,48 -> 514,53 -> 516,53 -> 516,44 -> 516,53 -> 518,53 -> 518,50 -> 518,53 -> 520,53 -> 520,46 -> 520,53
|
||||||
|
494,90 -> 494,92 -> 489,92 -> 489,100 -> 504,100 -> 504,92 -> 497,92 -> 497,90
|
||||||
|
507,24 -> 512,24
|
||||||
|
512,53 -> 512,43 -> 512,53 -> 514,53 -> 514,48 -> 514,53 -> 516,53 -> 516,44 -> 516,53 -> 518,53 -> 518,50 -> 518,53 -> 520,53 -> 520,46 -> 520,53
|
||||||
|
471,40 -> 475,40
|
||||||
|
480,118 -> 480,111 -> 480,118 -> 482,118 -> 482,116 -> 482,118 -> 484,118 -> 484,111 -> 484,118 -> 486,118 -> 486,110 -> 486,118 -> 488,118 -> 488,117 -> 488,118
|
||||||
|
511,81 -> 515,81
|
||||||
|
514,83 -> 518,83
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
512,53 -> 512,43 -> 512,53 -> 514,53 -> 514,48 -> 514,53 -> 516,53 -> 516,44 -> 516,53 -> 518,53 -> 518,50 -> 518,53 -> 520,53 -> 520,46 -> 520,53
|
||||||
|
465,40 -> 469,40
|
||||||
|
512,53 -> 512,43 -> 512,53 -> 514,53 -> 514,48 -> 514,53 -> 516,53 -> 516,44 -> 516,53 -> 518,53 -> 518,50 -> 518,53 -> 520,53 -> 520,46 -> 520,53
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
480,29 -> 490,29 -> 490,28
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
493,127 -> 498,127
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
504,26 -> 509,26
|
||||||
|
492,20 -> 497,20
|
||||||
|
477,36 -> 481,36
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
505,81 -> 509,81
|
||||||
|
512,53 -> 512,43 -> 512,53 -> 514,53 -> 514,48 -> 514,53 -> 516,53 -> 516,44 -> 516,53 -> 518,53 -> 518,50 -> 518,53 -> 520,53 -> 520,46 -> 520,53
|
||||||
|
513,69 -> 513,71 -> 511,71 -> 511,76 -> 522,76 -> 522,71 -> 517,71 -> 517,69
|
||||||
|
480,121 -> 480,122 -> 498,122 -> 498,121
|
||||||
|
494,90 -> 494,92 -> 489,92 -> 489,100 -> 504,100 -> 504,92 -> 497,92 -> 497,90
|
||||||
|
512,53 -> 512,43 -> 512,53 -> 514,53 -> 514,48 -> 514,53 -> 516,53 -> 516,44 -> 516,53 -> 518,53 -> 518,50 -> 518,53 -> 520,53 -> 520,46 -> 520,53
|
||||||
|
512,53 -> 512,43 -> 512,53 -> 514,53 -> 514,48 -> 514,53 -> 516,53 -> 516,44 -> 516,53 -> 518,53 -> 518,50 -> 518,53 -> 520,53 -> 520,46 -> 520,53
|
||||||
|
490,26 -> 495,26
|
||||||
|
504,129 -> 509,129
|
||||||
|
484,147 -> 484,149 -> 483,149 -> 483,153 -> 489,153 -> 489,149 -> 488,149 -> 488,147
|
||||||
|
484,147 -> 484,149 -> 483,149 -> 483,153 -> 489,153 -> 489,149 -> 488,149 -> 488,147
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
513,69 -> 513,71 -> 511,71 -> 511,76 -> 522,76 -> 522,71 -> 517,71 -> 517,69
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
503,22 -> 508,22
|
||||||
|
495,18 -> 500,18
|
||||||
|
490,129 -> 495,129
|
||||||
|
477,40 -> 481,40
|
||||||
|
520,56 -> 520,60 -> 517,60 -> 517,66 -> 528,66 -> 528,60 -> 523,60 -> 523,56
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
511,85 -> 515,85
|
||||||
|
502,87 -> 506,87
|
||||||
|
513,69 -> 513,71 -> 511,71 -> 511,76 -> 522,76 -> 522,71 -> 517,71 -> 517,69
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
500,127 -> 505,127
|
||||||
|
489,22 -> 494,22
|
||||||
|
499,14 -> 499,15 -> 508,15
|
||||||
|
480,118 -> 480,111 -> 480,118 -> 482,118 -> 482,116 -> 482,118 -> 484,118 -> 484,111 -> 484,118 -> 486,118 -> 486,110 -> 486,118 -> 488,118 -> 488,117 -> 488,118
|
||||||
|
483,40 -> 487,40
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
484,147 -> 484,149 -> 483,149 -> 483,153 -> 489,153 -> 489,149 -> 488,149 -> 488,147
|
||||||
|
480,118 -> 480,111 -> 480,118 -> 482,118 -> 482,116 -> 482,118 -> 484,118 -> 484,111 -> 484,118 -> 486,118 -> 486,110 -> 486,118 -> 488,118 -> 488,117 -> 488,118
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
497,26 -> 502,26
|
||||||
|
512,53 -> 512,43 -> 512,53 -> 514,53 -> 514,48 -> 514,53 -> 516,53 -> 516,44 -> 516,53 -> 518,53 -> 518,50 -> 518,53 -> 520,53 -> 520,46 -> 520,53
|
||||||
|
501,131 -> 506,131
|
||||||
|
468,38 -> 472,38
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
486,24 -> 491,24
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
480,118 -> 480,111 -> 480,118 -> 482,118 -> 482,116 -> 482,118 -> 484,118 -> 484,111 -> 484,118 -> 486,118 -> 486,110 -> 486,118 -> 488,118 -> 488,117 -> 488,118
|
||||||
|
471,36 -> 475,36
|
||||||
|
480,118 -> 480,111 -> 480,118 -> 482,118 -> 482,116 -> 482,118 -> 484,118 -> 484,111 -> 484,118 -> 486,118 -> 486,110 -> 486,118 -> 488,118 -> 488,117 -> 488,118
|
||||||
|
494,90 -> 494,92 -> 489,92 -> 489,100 -> 504,100 -> 504,92 -> 497,92 -> 497,90
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
512,53 -> 512,43 -> 512,53 -> 514,53 -> 514,48 -> 514,53 -> 516,53 -> 516,44 -> 516,53 -> 518,53 -> 518,50 -> 518,53 -> 520,53 -> 520,46 -> 520,53
|
||||||
|
484,147 -> 484,149 -> 483,149 -> 483,153 -> 489,153 -> 489,149 -> 488,149 -> 488,147
|
||||||
|
480,118 -> 480,111 -> 480,118 -> 482,118 -> 482,116 -> 482,118 -> 484,118 -> 484,111 -> 484,118 -> 486,118 -> 486,110 -> 486,118 -> 488,118 -> 488,117 -> 488,118
|
||||||
|
486,38 -> 490,38
|
||||||
|
513,69 -> 513,71 -> 511,71 -> 511,76 -> 522,76 -> 522,71 -> 517,71 -> 517,69
|
||||||
|
480,118 -> 480,111 -> 480,118 -> 482,118 -> 482,116 -> 482,118 -> 484,118 -> 484,111 -> 484,118 -> 486,118 -> 486,110 -> 486,118 -> 488,118 -> 488,117 -> 488,118
|
||||||
|
508,83 -> 512,83
|
||||||
|
512,53 -> 512,43 -> 512,53 -> 514,53 -> 514,48 -> 514,53 -> 516,53 -> 516,44 -> 516,53 -> 518,53 -> 518,50 -> 518,53 -> 520,53 -> 520,46 -> 520,53
|
||||||
|
486,104 -> 486,105 -> 493,105 -> 493,104
|
||||||
|
480,118 -> 480,111 -> 480,118 -> 482,118 -> 482,116 -> 482,118 -> 484,118 -> 484,111 -> 484,118 -> 486,118 -> 486,110 -> 486,118 -> 488,118 -> 488,117 -> 488,118
|
||||||
|
484,147 -> 484,149 -> 483,149 -> 483,153 -> 489,153 -> 489,149 -> 488,149 -> 488,147
|
||||||
|
480,29 -> 490,29 -> 490,28
|
||||||
|
484,147 -> 484,149 -> 483,149 -> 483,153 -> 489,153 -> 489,149 -> 488,149 -> 488,147
|
||||||
|
480,121 -> 480,122 -> 498,122 -> 498,121
|
||||||
|
500,24 -> 505,24
|
||||||
|
520,56 -> 520,60 -> 517,60 -> 517,66 -> 528,66 -> 528,60 -> 523,60 -> 523,56
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
494,90 -> 494,92 -> 489,92 -> 489,100 -> 504,100 -> 504,92 -> 497,92 -> 497,90
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
480,118 -> 480,111 -> 480,118 -> 482,118 -> 482,116 -> 482,118 -> 484,118 -> 484,111 -> 484,118 -> 486,118 -> 486,110 -> 486,118 -> 488,118 -> 488,117 -> 488,118
|
||||||
|
480,118 -> 480,111 -> 480,118 -> 482,118 -> 482,116 -> 482,118 -> 484,118 -> 484,111 -> 484,118 -> 486,118 -> 486,110 -> 486,118 -> 488,118 -> 488,117 -> 488,118
|
||||||
|
475,166 -> 475,159 -> 475,166 -> 477,166 -> 477,156 -> 477,166 -> 479,166 -> 479,165 -> 479,166 -> 481,166 -> 481,156 -> 481,166 -> 483,166 -> 483,163 -> 483,166 -> 485,166 -> 485,156 -> 485,166 -> 487,166 -> 487,159 -> 487,166
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
499,14 -> 499,15 -> 508,15
|
||||||
|
513,69 -> 513,71 -> 511,71 -> 511,76 -> 522,76 -> 522,71 -> 517,71 -> 517,69
|
||||||
|
494,90 -> 494,92 -> 489,92 -> 489,100 -> 504,100 -> 504,92 -> 497,92 -> 497,90
|
||||||
|
477,32 -> 481,32
|
||||||
|
471,144 -> 471,134 -> 471,144 -> 473,144 -> 473,140 -> 473,144 -> 475,144 -> 475,143 -> 475,144 -> 477,144 -> 477,142 -> 477,144 -> 479,144 -> 479,137 -> 479,144 -> 481,144 -> 481,134 -> 481,144 -> 483,144 -> 483,136 -> 483,144 -> 485,144 -> 485,134 -> 485,144
|
||||||
|
505,85 -> 509,85
|
||||||
|
520,56 -> 520,60 -> 517,60 -> 517,66 -> 528,66 -> 528,60 -> 523,60 -> 523,56
|
@ -1,3 +1,191 @@
|
|||||||
fn main() {
|
use std::fs::read_to_string;
|
||||||
println!("Hello, world!");
|
|
||||||
|
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||||
|
struct Map {
|
||||||
|
min_x: usize,
|
||||||
|
width: usize,
|
||||||
|
height: usize,
|
||||||
|
map: Vec<bool>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Map {
|
||||||
|
fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
min_x: 500,
|
||||||
|
width: 0,
|
||||||
|
height: 0,
|
||||||
|
map: vec![],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn print(&self) {
|
||||||
|
for y in 0..self.height {
|
||||||
|
for x in 0..self.width {
|
||||||
|
print!(
|
||||||
|
"{}",
|
||||||
|
if self.map[x + y * self.width] {
|
||||||
|
'#'
|
||||||
|
} else {
|
||||||
|
'.'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
println!();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn at(&self, position: (usize, usize)) -> bool {
|
||||||
|
if !self.is_inside(position) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let x = position.0 - self.min_x;
|
||||||
|
self.map[x + position.1 * self.width]
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_inside(&self, position: (usize, usize)) -> bool {
|
||||||
|
position.0 >= self.min_x && position.0 < self.min_x + self.width && position.1 < self.height
|
||||||
|
}
|
||||||
|
|
||||||
|
fn add_obstacle(&mut self, position: (usize, usize)) {
|
||||||
|
while self.min_x > position.0 {
|
||||||
|
self.extend_left();
|
||||||
|
}
|
||||||
|
while self.min_x + self.width <= position.0 {
|
||||||
|
self.extend_right();
|
||||||
|
}
|
||||||
|
while self.height <= position.1 {
|
||||||
|
self.extend_down();
|
||||||
|
}
|
||||||
|
let x = position.0 - self.min_x;
|
||||||
|
self.map[x + position.1 * self.width] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn extend_down(&mut self) {
|
||||||
|
self.map.append(&mut vec![false; self.width]);
|
||||||
|
self.height += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn extend_left(&mut self) {
|
||||||
|
self.map.append(&mut vec![false; self.height]);
|
||||||
|
for y in (0..self.height).rev() {
|
||||||
|
for x in (0..self.width).rev() {
|
||||||
|
self.map[(x + 1) + y * (self.width + 1)] = self.map[x + y * self.width];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.width += 1;
|
||||||
|
self.min_x -= 1;
|
||||||
|
for y in 0..self.height {
|
||||||
|
self.map[y * self.width] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn extend_right(&mut self) {
|
||||||
|
self.map.append(&mut vec![false; self.height]);
|
||||||
|
for y in (0..self.height).rev() {
|
||||||
|
for x in (0..self.width).rev() {
|
||||||
|
self.map[x + y * (self.width + 1)] = self.map[x + y * self.width];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.width += 1;
|
||||||
|
for y in 0..self.height {
|
||||||
|
self.map[self.width - 1 + y * self.width] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn add_sand(map: &Map) -> Option<(usize, usize)> {
|
||||||
|
let mut sand = (500, 0);
|
||||||
|
while map.is_inside(sand) {
|
||||||
|
let x = sand.0;
|
||||||
|
let y = sand.1;
|
||||||
|
if !map.at((x, y + 1)) {
|
||||||
|
sand.1 += 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if !map.at((x - 1, y + 1)) {
|
||||||
|
sand.1 += 1;
|
||||||
|
sand.0 -= 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if !map.at((x + 1, y + 1)) {
|
||||||
|
sand.1 += 1;
|
||||||
|
sand.0 += 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return Some(sand);
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
fn add_sand_floor(map: &Map, floor: usize) -> Option<(usize, usize)> {
|
||||||
|
let mut sand = (500, 0);
|
||||||
|
while !map.at((500, 0)) {
|
||||||
|
let x = sand.0;
|
||||||
|
let y = sand.1;
|
||||||
|
if y + 1 == floor {
|
||||||
|
return Some(sand);
|
||||||
|
}
|
||||||
|
if !map.at((x, y + 1)) {
|
||||||
|
sand.1 += 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if !map.at((x - 1, y + 1)) {
|
||||||
|
sand.1 += 1;
|
||||||
|
sand.0 -= 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if !map.at((x + 1, y + 1)) {
|
||||||
|
sand.1 += 1;
|
||||||
|
sand.0 += 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return Some(sand);
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let input = "498,4 -> 498,6 -> 496,6
|
||||||
|
503,4 -> 502,4 -> 502,9 -> 494,9"
|
||||||
|
.to_owned();
|
||||||
|
let input = read_to_string("input.txt").unwrap_or(input);
|
||||||
|
let mut map = Map::new();
|
||||||
|
for line in input.lines() {
|
||||||
|
let points = line.split(" -> ").map(|coord| {
|
||||||
|
let [x, y] = coord.split(',').map(|n| n.parse::<usize>().unwrap()).collect::<Vec<_>>()[..] else {panic!()};
|
||||||
|
(x, y)
|
||||||
|
}).collect::<Vec<_>>();
|
||||||
|
for line in points.windows(2) {
|
||||||
|
let (x1, y1) = line[0];
|
||||||
|
let (x2, y2) = line[1];
|
||||||
|
let x_min = x1.min(x2);
|
||||||
|
let x_max = x1.max(x2);
|
||||||
|
let y_min = y1.min(y2);
|
||||||
|
let y_max = y1.max(y2);
|
||||||
|
for x in x_min..=x_max {
|
||||||
|
for y in y_min..=y_max {
|
||||||
|
map.add_obstacle((x, y));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
println!("printing map:");
|
||||||
|
map.print();
|
||||||
|
let mut num_sand = 0;
|
||||||
|
while let Some(sand) = add_sand(&map) {
|
||||||
|
map.add_obstacle(sand);
|
||||||
|
num_sand += 1;
|
||||||
|
}
|
||||||
|
println!();
|
||||||
|
map.print();
|
||||||
|
println!("needed {num_sand} sand particles");
|
||||||
|
let floor = map.height + 1;
|
||||||
|
println!("floor: {floor}");
|
||||||
|
while let Some(sand) = add_sand_floor(&map, floor) {
|
||||||
|
map.add_obstacle(sand);
|
||||||
|
num_sand += 1;
|
||||||
|
}
|
||||||
|
println!();
|
||||||
|
map.print();
|
||||||
|
println!("needed {num_sand} sand particles");
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use std::{fs::read_to_string, iter::Peekable, str::Lines};
|
use std::{collections::HashMap, fs::read_to_string, iter::Peekable, str::Lines};
|
||||||
|
|
||||||
|
/*
|
||||||
#[derive(PartialEq, Debug)]
|
#[derive(PartialEq, Debug)]
|
||||||
struct File {
|
struct File {
|
||||||
name: String,
|
name: String,
|
||||||
@ -115,3 +116,68 @@ fn main() {
|
|||||||
let sol2 = sizes.filter(|s| s >= &additional).min().unwrap();
|
let sol2 = sizes.filter(|s| s >= &additional).min().unwrap();
|
||||||
println!("Deleting Directory with size {sol2}");
|
println!("Deleting Directory with size {sol2}");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let input = read_to_string("input.txt").unwrap();
|
||||||
|
let mut cwd = "/".to_owned();
|
||||||
|
let mut files = HashMap::new();
|
||||||
|
for line in input.lines() {
|
||||||
|
let line = line.split_whitespace().collect::<Vec<_>>();
|
||||||
|
match line.len() {
|
||||||
|
3 => match line[2] {
|
||||||
|
"/" => cwd = "/".to_owned(),
|
||||||
|
".." => {
|
||||||
|
cwd = {
|
||||||
|
if cwd == "/" {
|
||||||
|
cwd
|
||||||
|
} else {
|
||||||
|
let dirs = cwd.split_inclusive('/').collect::<Vec<_>>();
|
||||||
|
let nwd = dirs[..(dirs.len() - 1)]
|
||||||
|
.iter()
|
||||||
|
.fold(String::new(), |s, v| s + v);
|
||||||
|
nwd
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dir => cwd = cwd + dir + "/",
|
||||||
|
},
|
||||||
|
2 => {
|
||||||
|
if (line[0] != "$") && (line[0] != "dir") {
|
||||||
|
let size = line[0].parse::<usize>().unwrap();
|
||||||
|
let path = cwd.clone() + line[1];
|
||||||
|
files.insert(path, size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let mut directories = HashMap::new();
|
||||||
|
for (path, size) in files {
|
||||||
|
let mut folders = path
|
||||||
|
.split_terminator('/')
|
||||||
|
.map(|s| s.to_owned())
|
||||||
|
.collect::<Vec<String>>();
|
||||||
|
folders.pop();
|
||||||
|
for (index, folder) in folders.clone().iter().enumerate() {
|
||||||
|
let previus = if index > 0 { &folders[index - 1] } else { "" };
|
||||||
|
folders[index] = previus.to_owned() + folder + "/";
|
||||||
|
}
|
||||||
|
for folder in folders {
|
||||||
|
*directories.entry(folder).or_insert(0) += size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let result1: usize = directories.values().filter(|&&size| size < 100_000).sum();
|
||||||
|
const TOTAL_SPACE: usize = 70000000;
|
||||||
|
const NEEDED_FREE: usize = 30000000;
|
||||||
|
let used = *directories.entry("/".to_owned()).or_insert(0);
|
||||||
|
let free = TOTAL_SPACE - used;
|
||||||
|
let additional = NEEDED_FREE - free;
|
||||||
|
let result2: usize = directories
|
||||||
|
.values()
|
||||||
|
.filter(|&&size| size >= additional)
|
||||||
|
.min()
|
||||||
|
.map(|size| *size)
|
||||||
|
.unwrap_or(0);
|
||||||
|
println!("{result1} bytes used by directories smaller than 100000. {result2} Bytes removed by the smallest directory");
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user