- commit
- 0b0c9de03fdf067506200d9be099411c07263872
- parent
- 5b58b640d86d7857b011ae38b5d9719910130d97
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2024-12-06 10:20
2024-12-05
Diffstat
A | 2024/05/input.txt | 1364 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2024/05/solution.rs | 56 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2024/05/test.txt | 28 | ++++++++++++++++++++++++++++ |
3 files changed, 1448 insertions, 0 deletions
diff --git a/2024/05/input.txt b/2024/05/input.txt
@@ -0,0 +1,1364 @@ -1 1 11|42 -1 2 53|45 -1 3 53|81 -1 4 21|97 -1 5 21|88 -1 6 21|22 -1 7 29|27 -1 8 29|78 -1 9 29|81 -1 10 29|66 -1 11 64|63 -1 12 64|52 -1 13 64|92 -1 14 64|82 -1 15 64|72 -1 16 56|36 -1 17 56|29 -1 18 56|78 -1 19 56|73 -1 20 56|55 -1 21 56|84 -1 22 59|18 -1 23 59|14 -1 24 59|13 -1 25 59|19 -1 26 59|88 -1 27 59|75 -1 28 59|16 -1 29 42|41 -1 30 42|16 -1 31 42|53 -1 32 42|56 -1 33 42|52 -1 34 42|59 -1 35 42|88 -1 36 42|29 -1 37 13|43 -1 38 13|79 -1 39 13|11 -1 40 13|97 -1 41 13|27 -1 42 13|45 -1 43 13|42 -1 44 13|66 -1 45 13|21 -1 46 16|18 -1 47 16|78 -1 48 16|41 -1 49 16|75 -1 50 16|13 -1 51 16|68 -1 52 16|54 -1 53 16|82 -1 54 16|84 -1 55 16|88 -1 56 79|36 -1 57 79|52 -1 58 79|82 -1 59 79|63 -1 60 79|53 -1 61 79|75 -1 62 79|72 -1 63 79|91 -1 64 79|78 -1 65 79|18 -1 66 79|73 -1 67 68|69 -1 68 68|76 -1 69 68|32 -1 70 68|45 -1 71 68|27 -1 72 68|42 -1 73 68|66 -1 74 68|21 -1 75 68|71 -1 76 68|11 -1 77 68|54 -1 78 68|95 -1 79 72|92 -1 80 72|66 -1 81 72|65 -1 82 72|13 -1 83 72|68 -1 84 72|71 -1 85 72|76 -1 86 72|81 -1 87 72|21 -1 88 72|73 -1 89 72|11 -1 90 72|15 -1 91 72|54 -1 92 78|66 -1 93 78|81 -1 94 78|69 -1 95 78|92 -1 96 78|94 -1 97 78|71 -1 98 78|53 -1 99 78|36 -1 100 78|33 -1 101 78|14 -1 102 78|82 -1 103 78|27 -1 104 78|13 -1 105 78|93 -1 106 52|75 -1 107 52|29 -1 108 52|18 -1 109 52|27 -1 110 52|14 -1 111 52|72 -1 112 52|68 -1 113 52|91 -1 114 52|73 -1 115 52|93 -1 116 52|54 -1 117 52|78 -1 118 52|94 -1 119 52|84 -1 120 52|19 -1 121 54|76 -1 122 54|85 -1 123 54|63 -1 124 54|33 -1 125 54|65 -1 126 54|66 -1 127 54|97 -1 128 54|79 -1 129 54|69 -1 130 54|42 -1 131 54|64 -1 132 54|11 -1 133 54|95 -1 134 54|55 -1 135 54|27 -1 136 54|71 -1 137 95|43 -1 138 95|59 -1 139 95|85 -1 140 95|97 -1 141 95|79 -1 142 95|29 -1 143 95|96 -1 144 95|75 -1 145 95|91 -1 146 95|42 -1 147 95|16 -1 148 95|63 -1 149 95|41 -1 150 95|88 -1 151 95|78 -1 152 95|64 -1 153 95|32 -1 154 55|45 -1 155 55|52 -1 156 55|18 -1 157 55|91 -1 158 55|79 -1 159 55|64 -1 160 55|59 -1 161 55|41 -1 162 55|63 -1 163 55|96 -1 164 55|85 -1 165 55|16 -1 166 55|42 -1 167 55|95 -1 168 55|76 -1 169 55|43 -1 170 55|22 -1 171 55|97 -1 172 85|22 -1 173 85|16 -1 174 85|41 -1 175 85|78 -1 176 85|79 -1 177 85|63 -1 178 85|14 -1 179 85|32 -1 180 85|29 -1 181 85|97 -1 182 85|53 -1 183 85|56 -1 184 85|91 -1 185 85|59 -1 186 85|52 -1 187 85|43 -1 188 85|19 -1 189 85|96 -1 190 85|75 -1 191 14|71 -1 192 14|65 -1 193 14|84 -1 194 14|93 -1 195 14|54 -1 196 14|45 -1 197 14|42 -1 198 14|76 -1 199 14|13 -1 200 14|81 -1 201 14|27 -1 202 14|94 -1 203 14|68 -1 204 14|11 -1 205 14|95 -1 206 14|82 -1 207 14|15 -1 208 14|66 -1 209 14|69 -1 210 14|73 -1 211 32|75 -1 212 32|41 -1 213 32|19 -1 214 32|36 -1 215 32|43 -1 216 32|14 -1 217 32|96 -1 218 32|52 -1 219 32|59 -1 220 32|79 -1 221 32|72 -1 222 32|78 -1 223 32|53 -1 224 32|29 -1 225 32|63 -1 226 32|56 -1 227 32|82 -1 228 32|64 -1 229 32|84 -1 230 32|91 -1 231 32|22 -1 232 27|71 -1 233 27|16 -1 234 27|43 -1 235 27|45 -1 236 27|64 -1 237 27|79 -1 238 27|96 -1 239 27|42 -1 240 27|21 -1 241 27|81 -1 242 27|63 -1 243 27|11 -1 244 27|66 -1 245 27|85 -1 246 27|33 -1 247 27|55 -1 248 27|15 -1 249 27|69 -1 250 27|97 -1 251 27|65 -1 252 27|76 -1 253 27|59 -1 254 36|53 -1 255 36|94 -1 256 36|54 -1 257 36|76 -1 258 36|45 -1 259 36|15 -1 260 36|73 -1 261 36|65 -1 262 36|13 -1 263 36|92 -1 264 36|69 -1 265 36|82 -1 266 36|84 -1 267 36|33 -1 268 36|93 -1 269 36|81 -1 270 36|55 -1 271 36|72 -1 272 36|14 -1 273 36|27 -1 274 36|71 -1 275 36|66 -1 276 36|11 -1 277 15|42 -1 278 15|91 -1 279 15|41 -1 280 15|65 -1 281 15|97 -1 282 15|22 -1 283 15|43 -1 284 15|18 -1 285 15|64 -1 286 15|79 -1 287 15|21 -1 288 15|96 -1 289 15|32 -1 290 15|76 -1 291 15|11 -1 292 15|88 -1 293 15|85 -1 294 15|95 -1 295 15|52 -1 296 15|63 -1 297 15|59 -1 298 15|56 -1 299 15|16 -1 300 15|45 -1 301 19|94 -1 302 19|13 -1 303 19|82 -1 304 19|14 -1 305 19|73 -1 306 19|33 -1 307 19|69 -1 308 19|76 -1 309 19|27 -1 310 19|15 -1 311 19|72 -1 312 19|45 -1 313 19|55 -1 314 19|66 -1 315 19|81 -1 316 19|92 -1 317 19|54 -1 318 19|68 -1 319 19|93 -1 320 19|53 -1 321 19|11 -1 322 19|36 -1 323 19|71 -1 324 19|84 -1 325 97|29 -1 326 97|78 -1 327 97|64 -1 328 97|53 -1 329 97|63 -1 330 97|43 -1 331 97|52 -1 332 97|91 -1 333 97|18 -1 334 97|22 -1 335 97|16 -1 336 97|14 -1 337 97|79 -1 338 97|32 -1 339 97|75 -1 340 97|88 -1 341 97|59 -1 342 97|36 -1 343 97|82 -1 344 97|96 -1 345 97|72 -1 346 97|19 -1 347 97|56 -1 348 97|41 -1 349 75|71 -1 350 75|55 -1 351 75|69 -1 352 75|15 -1 353 75|33 -1 354 75|82 -1 355 75|84 -1 356 75|93 -1 357 75|92 -1 358 75|73 -1 359 75|19 -1 360 75|78 -1 361 75|94 -1 362 75|54 -1 363 75|36 -1 364 75|81 -1 365 75|27 -1 366 75|68 -1 367 75|14 -1 368 75|13 -1 369 75|72 -1 370 75|53 -1 371 75|66 -1 372 75|11 -1 373 22|91 -1 374 22|75 -1 375 22|88 -1 376 22|56 -1 377 22|72 -1 378 22|14 -1 379 22|19 -1 380 22|13 -1 381 22|92 -1 382 22|52 -1 383 22|68 -1 384 22|27 -1 385 22|73 -1 386 22|41 -1 387 22|93 -1 388 22|36 -1 389 22|78 -1 390 22|94 -1 391 22|82 -1 392 22|29 -1 393 22|84 -1 394 22|54 -1 395 22|53 -1 396 22|18 -1 397 91|68 -1 398 91|81 -1 399 91|75 -1 400 91|71 -1 401 91|82 -1 402 91|92 -1 403 91|33 -1 404 91|27 -1 405 91|73 -1 406 91|56 -1 407 91|36 -1 408 91|19 -1 409 91|13 -1 410 91|54 -1 411 91|93 -1 412 91|18 -1 413 91|94 -1 414 91|14 -1 415 91|84 -1 416 91|72 -1 417 91|69 -1 418 91|53 -1 419 91|78 -1 420 91|29 -1 421 92|97 -1 422 92|76 -1 423 92|21 -1 424 92|13 -1 425 92|45 -1 426 92|69 -1 427 92|81 -1 428 92|54 -1 429 92|42 -1 430 92|68 -1 431 92|95 -1 432 92|32 -1 433 92|11 -1 434 92|15 -1 435 92|93 -1 436 92|33 -1 437 92|66 -1 438 92|27 -1 439 92|71 -1 440 92|55 -1 441 92|73 -1 442 92|65 -1 443 92|94 -1 444 92|85 -1 445 66|43 -1 446 66|22 -1 447 66|88 -1 448 66|79 -1 449 66|55 -1 450 66|21 -1 451 66|41 -1 452 66|63 -1 453 66|95 -1 454 66|64 -1 455 66|11 -1 456 66|85 -1 457 66|97 -1 458 66|59 -1 459 66|91 -1 460 66|45 -1 461 66|65 -1 462 66|42 -1 463 66|76 -1 464 66|16 -1 465 66|96 -1 466 66|52 -1 467 66|32 -1 468 66|15 -1 469 65|79 -1 470 65|41 -1 471 65|19 -1 472 65|18 -1 473 65|85 -1 474 65|95 -1 475 65|22 -1 476 65|91 -1 477 65|56 -1 478 65|43 -1 479 65|88 -1 480 65|64 -1 481 65|63 -1 482 65|75 -1 483 65|52 -1 484 65|16 -1 485 65|59 -1 486 65|78 -1 487 65|97 -1 488 65|21 -1 489 65|96 -1 490 65|29 -1 491 65|32 -1 492 65|42 -1 493 88|93 -1 494 88|19 -1 495 88|73 -1 496 88|36 -1 497 88|27 -1 498 88|81 -1 499 88|69 -1 500 88|53 -1 501 88|92 -1 502 88|54 -1 503 88|18 -1 504 88|68 -1 505 88|84 -1 506 88|91 -1 507 88|13 -1 508 88|75 -1 509 88|78 -1 510 88|29 -1 511 88|82 -1 512 88|56 -1 513 88|72 -1 514 88|94 -1 515 88|71 -1 516 88|14 -1 517 84|92 -1 518 84|95 -1 519 84|85 -1 520 84|13 -1 521 84|73 -1 522 84|65 -1 523 84|33 -1 524 84|66 -1 525 84|45 -1 526 84|42 -1 527 84|76 -1 528 84|11 -1 529 84|68 -1 530 84|97 -1 531 84|94 -1 532 84|21 -1 533 84|71 -1 534 84|15 -1 535 84|27 -1 536 84|55 -1 537 84|54 -1 538 84|81 -1 539 84|69 -1 540 84|93 -1 541 94|81 -1 542 94|93 -1 543 94|13 -1 544 94|32 -1 545 94|79 -1 546 94|85 -1 547 94|21 -1 548 94|69 -1 549 94|15 -1 550 94|71 -1 551 94|11 -1 552 94|68 -1 553 94|33 -1 554 94|55 -1 555 94|65 -1 556 94|76 -1 557 94|95 -1 558 94|64 -1 559 94|54 -1 560 94|27 -1 561 94|97 -1 562 94|66 -1 563 94|45 -1 564 94|42 -1 565 18|69 -1 566 18|29 -1 567 18|81 -1 568 18|72 -1 569 18|92 -1 570 18|73 -1 571 18|93 -1 572 18|75 -1 573 18|53 -1 574 18|54 -1 575 18|56 -1 576 18|78 -1 577 18|71 -1 578 18|82 -1 579 18|66 -1 580 18|36 -1 581 18|68 -1 582 18|84 -1 583 18|27 -1 584 18|14 -1 585 18|33 -1 586 18|13 -1 587 18|94 -1 588 18|19 -1 589 81|11 -1 590 81|45 -1 591 81|63 -1 592 81|95 -1 593 81|22 -1 594 81|66 -1 595 81|15 -1 596 81|96 -1 597 81|43 -1 598 81|59 -1 599 81|41 -1 600 81|32 -1 601 81|33 -1 602 81|64 -1 603 81|85 -1 604 81|42 -1 605 81|79 -1 606 81|97 -1 607 81|21 -1 608 81|16 -1 609 81|55 -1 610 81|76 -1 611 81|65 -1 612 81|71 -1 613 93|45 -1 614 93|96 -1 615 93|21 -1 616 93|27 -1 617 93|33 -1 618 93|64 -1 619 93|85 -1 620 93|11 -1 621 93|15 -1 622 93|43 -1 623 93|59 -1 624 93|79 -1 625 93|97 -1 626 93|32 -1 627 93|63 -1 628 93|76 -1 629 93|42 -1 630 93|95 -1 631 93|55 -1 632 93|71 -1 633 93|81 -1 634 93|65 -1 635 93|69 -1 636 93|66 -1 637 82|92 -1 638 82|81 -1 639 82|94 -1 640 82|93 -1 641 82|73 -1 642 82|66 -1 643 82|21 -1 644 82|45 -1 645 82|27 -1 646 82|13 -1 647 82|69 -1 648 82|76 -1 649 82|95 -1 650 82|15 -1 651 82|71 -1 652 82|54 -1 653 82|11 -1 654 82|84 -1 655 82|68 -1 656 82|42 -1 657 82|55 -1 658 82|85 -1 659 82|65 -1 660 82|33 -1 661 71|15 -1 662 71|76 -1 663 71|32 -1 664 71|21 -1 665 71|79 -1 666 71|64 -1 667 71|97 -1 668 71|22 -1 669 71|11 -1 670 71|33 -1 671 71|85 -1 672 71|16 -1 673 71|96 -1 674 71|42 -1 675 71|52 -1 676 71|43 -1 677 71|95 -1 678 71|41 -1 679 71|59 -1 680 71|66 -1 681 71|63 -1 682 71|65 -1 683 71|55 -1 684 71|45 -1 685 41|88 -1 686 41|92 -1 687 41|36 -1 688 41|53 -1 689 41|69 -1 690 41|19 -1 691 41|91 -1 692 41|27 -1 693 41|78 -1 694 41|93 -1 695 41|84 -1 696 41|73 -1 697 41|29 -1 698 41|13 -1 699 41|14 -1 700 41|54 -1 701 41|82 -1 702 41|72 -1 703 41|94 -1 704 41|52 -1 705 41|56 -1 706 41|18 -1 707 41|68 -1 708 41|75 -1 709 63|43 -1 710 63|59 -1 711 63|14 -1 712 63|22 -1 713 63|88 -1 714 63|73 -1 715 63|96 -1 716 63|56 -1 717 63|75 -1 718 63|82 -1 719 63|52 -1 720 63|18 -1 721 63|16 -1 722 63|91 -1 723 63|19 -1 724 63|36 -1 725 63|94 -1 726 63|72 -1 727 63|84 -1 728 63|53 -1 729 63|78 -1 730 63|41 -1 731 63|29 -1 732 63|92 -1 733 33|96 -1 734 33|85 -1 735 33|41 -1 736 33|65 -1 737 33|66 -1 738 33|22 -1 739 33|95 -1 740 33|64 -1 741 33|32 -1 742 33|52 -1 743 33|45 -1 744 33|16 -1 745 33|55 -1 746 33|42 -1 747 33|21 -1 748 33|79 -1 749 33|97 -1 750 33|11 -1 751 33|59 -1 752 33|76 -1 753 33|15 -1 754 33|43 -1 755 33|63 -1 756 33|88 -1 757 43|14 -1 758 43|72 -1 759 43|41 -1 760 43|82 -1 761 43|78 -1 762 43|53 -1 763 43|56 -1 764 43|52 -1 765 43|91 -1 766 43|16 -1 767 43|96 -1 768 43|75 -1 769 43|18 -1 770 43|22 -1 771 43|92 -1 772 43|88 -1 773 43|68 -1 774 43|73 -1 775 43|59 -1 776 43|94 -1 777 43|84 -1 778 43|29 -1 779 43|19 -1 780 43|36 -1 781 96|88 -1 782 96|78 -1 783 96|94 -1 784 96|84 -1 785 96|75 -1 786 96|68 -1 787 96|53 -1 788 96|91 -1 789 96|52 -1 790 96|56 -1 791 96|16 -1 792 96|19 -1 793 96|59 -1 794 96|22 -1 795 96|73 -1 796 96|14 -1 797 96|82 -1 798 96|29 -1 799 96|36 -1 800 96|54 -1 801 96|72 -1 802 96|92 -1 803 96|41 -1 804 96|18 -1 805 45|63 -1 806 45|59 -1 807 45|96 -1 808 45|29 -1 809 45|88 -1 810 45|95 -1 811 45|16 -1 812 45|32 -1 813 45|64 -1 814 45|78 -1 815 45|21 -1 816 45|18 -1 817 45|22 -1 818 45|97 -1 819 45|43 -1 820 45|41 -1 821 45|85 -1 822 45|75 -1 823 45|79 -1 824 45|42 -1 825 45|91 -1 826 45|56 -1 827 45|65 -1 828 45|52 -1 829 73|11 -1 830 73|71 -1 831 73|32 -1 832 73|13 -1 833 73|68 -1 834 73|69 -1 835 73|97 -1 836 73|55 -1 837 73|21 -1 838 73|81 -1 839 73|42 -1 840 73|54 -1 841 73|85 -1 842 73|15 -1 843 73|65 -1 844 73|45 -1 845 73|95 -1 846 73|94 -1 847 73|64 -1 848 73|76 -1 849 73|93 -1 850 73|27 -1 851 73|66 -1 852 73|33 -1 853 69|32 -1 854 69|55 -1 855 69|11 -1 856 69|66 -1 857 69|45 -1 858 69|16 -1 859 69|65 -1 860 69|42 -1 861 69|95 -1 862 69|96 -1 863 69|76 -1 864 69|71 -1 865 69|59 -1 866 69|21 -1 867 69|15 -1 868 69|63 -1 869 69|85 -1 870 69|22 -1 871 69|43 -1 872 69|97 -1 873 69|33 -1 874 69|64 -1 875 69|79 -1 876 69|81 -1 877 76|52 -1 878 76|64 -1 879 76|18 -1 880 76|91 -1 881 76|16 -1 882 76|41 -1 883 76|21 -1 884 76|85 -1 885 76|32 -1 886 76|59 -1 887 76|56 -1 888 76|75 -1 889 76|42 -1 890 76|45 -1 891 76|88 -1 892 76|97 -1 893 76|29 -1 894 76|96 -1 895 76|79 -1 896 76|43 -1 897 76|65 -1 898 76|95 -1 899 76|63 -1 900 76|22 -1 901 11|29 -1 902 11|96 -1 903 11|45 -1 904 11|43 -1 905 11|65 -1 906 11|22 -1 907 11|76 -1 908 11|21 -1 909 11|59 -1 910 11|56 -1 911 11|97 -1 912 11|91 -1 913 11|85 -1 914 11|88 -1 915 11|64 -1 916 11|52 -1 917 11|95 -1 918 11|16 -1 919 11|32 -1 920 11|79 -1 921 11|18 -1 922 11|63 -1 923 11|41 -1 924 53|27 -1 925 53|15 -1 926 53|33 -1 927 53|14 -1 928 53|92 -1 929 53|54 -1 930 53|82 -1 931 53|55 -1 932 53|84 -1 933 53|68 -1 934 53|94 -1 935 53|66 -1 936 53|11 -1 937 53|69 -1 938 53|71 -1 939 53|76 -1 940 53|72 -1 941 53|93 -1 942 53|13 -1 943 53|73 -1 944 53|95 -1 945 53|65 -1 946 21|63 -1 947 21|91 -1 948 21|41 -1 949 21|53 -1 950 21|19 -1 951 21|85 -1 952 21|43 -1 953 21|52 -1 954 21|36 -1 955 21|16 -1 956 21|18 -1 957 21|75 -1 958 21|64 -1 959 21|29 -1 960 21|59 -1 961 21|79 -1 962 21|32 -1 963 21|56 -1 964 21|96 -1 965 21|78 -1 966 21|14 -1 967 29|55 -1 968 29|33 -1 969 29|53 -1 970 29|71 -1 971 29|19 -1 972 29|36 -1 973 29|94 -1 974 29|82 -1 975 29|92 -1 976 29|54 -1 977 29|72 -1 978 29|84 -1 979 29|13 -1 980 29|75 -1 981 29|15 -1 982 29|14 -1 983 29|73 -1 984 29|93 -1 985 29|68 -1 986 29|69 -1 987 64|59 -1 988 64|79 -1 989 64|75 -1 990 64|53 -1 991 64|88 -1 992 64|91 -1 993 64|56 -1 994 64|14 -1 995 64|36 -1 996 64|78 -1 997 64|41 -1 998 64|16 -1 999 64|84 -1 1000 64|18 -1 1001 64|22 -1 1002 64|96 -1 1003 64|29 -1 1004 64|19 -1 1005 64|43 -1 1006 56|54 -1 1007 56|19 -1 1008 56|68 -1 1009 56|72 -1 1010 56|69 -1 1011 56|33 -1 1012 56|94 -1 1013 56|66 -1 1014 56|92 -1 1015 56|13 -1 1016 56|82 -1 1017 56|71 -1 1018 56|93 -1 1019 56|53 -1 1020 56|14 -1 1021 56|81 -1 1022 56|75 -1 1023 56|27 -1 1024 59|68 -1 1025 59|84 -1 1026 59|36 -1 1027 59|54 -1 1028 59|82 -1 1029 59|52 -1 1030 59|53 -1 1031 59|78 -1 1032 59|22 -1 1033 59|91 -1 1034 59|72 -1 1035 59|94 -1 1036 59|56 -1 1037 59|29 -1 1038 59|41 -1 1039 59|92 -1 1040 59|73 -1 1041 42|85 -1 1042 42|21 -1 1043 42|22 -1 1044 42|63 -1 1045 42|97 -1 1046 42|78 -1 1047 42|75 -1 1048 42|36 -1 1049 42|43 -1 1050 42|96 -1 1051 42|32 -1 1052 42|18 -1 1053 42|79 -1 1054 42|91 -1 1055 42|19 -1 1056 42|64 -1 1057 13|32 -1 1058 13|65 -1 1059 13|55 -1 1060 13|69 -1 1061 13|96 -1 1062 13|93 -1 1063 13|63 -1 1064 13|95 -1 1065 13|81 -1 1066 13|71 -1 1067 13|33 -1 1068 13|76 -1 1069 13|85 -1 1070 13|15 -1 1071 13|64 -1 1072 16|22 -1 1073 16|56 -1 1074 16|73 -1 1075 16|19 -1 1076 16|14 -1 1077 16|36 -1 1078 16|53 -1 1079 16|29 -1 1080 16|93 -1 1081 16|52 -1 1082 16|72 -1 1083 16|94 -1 1084 16|92 -1 1085 16|91 -1 1086 79|88 -1 1087 79|22 -1 1088 79|19 -1 1089 79|96 -1 1090 79|56 -1 1091 79|16 -1 1092 79|41 -1 1093 79|43 -1 1094 79|84 -1 1095 79|29 -1 1096 79|14 -1 1097 79|59 -1 1098 79|92 -1 1099 68|63 -1 1100 68|65 -1 1101 68|64 -1 1102 68|93 -1 1103 68|79 -1 1104 68|81 -1 1105 68|55 -1 1106 68|97 -1 1107 68|33 -1 1108 68|15 -1 1109 68|13 -1 1110 68|85 -1 1111 72|95 -1 1112 72|84 -1 1113 72|55 -1 1114 72|93 -1 1115 72|42 -1 1116 72|33 -1 1117 72|69 -1 1118 72|82 -1 1119 72|27 -1 1120 72|45 -1 1121 72|94 -1 1122 78|73 -1 1123 78|76 -1 1124 78|72 -1 1125 78|68 -1 1126 78|11 -1 1127 78|54 -1 1128 78|84 -1 1129 78|15 -1 1130 78|55 -1 1131 78|19 -1 1132 52|36 -1 1133 52|69 -1 1134 52|81 -1 1135 52|82 -1 1136 52|56 -1 1137 52|88 -1 1138 52|92 -1 1139 52|13 -1 1140 52|53 -1 1141 54|43 -1 1142 54|45 -1 1143 54|21 -1 1144 54|32 -1 1145 54|13 -1 1146 54|93 -1 1147 54|15 -1 1148 54|81 -1 1149 95|19 -1 1150 95|36 -1 1151 95|22 -1 1152 95|56 -1 1153 95|21 -1 1154 95|18 -1 1155 95|52 -1 1156 55|88 -1 1157 55|65 -1 1158 55|21 -1 1159 55|32 -1 1160 55|15 -1 1161 55|11 -1 1162 85|36 -1 1163 85|18 -1 1164 85|64 -1 1165 85|72 -1 1166 85|88 -1 1167 14|33 -1 1168 14|72 -1 1169 14|92 -1 1170 14|55 -1 1171 32|16 -1 1172 32|18 -1 1173 32|88 -1 1174 27|32 -1 1175 27|95 -1 1176 36|68 -1 1177 -1 1178 32,64,63,43,59,16,52,88,91,29,75,19,36,53,14,72,82 -1 1179 56,29,22,85,64,63,43,45,65,41,96,42,75 -1 1180 52,41,14,84,72,78,73,36,68,88,94,91,16,19,13,92,53 -1 1181 85,32,79,52,91,78,14 -1 1182 21,59,43,81,16,45,55,64,11,85,33,42,32,15,22 -1 1183 21,22,41,42,95,45,91,97,96 -1 1184 45,95,21,32,79,43,96,59,16,41,91,18,56,29,75 -1 1185 29,54,88,81,92,27,82,18,69,19,94,68,78,91,84,93,13 -1 1186 22,56,92,52,91,18,19 -1 1187 79,96,88,18,92,19,78,14,59,84,53,72,43,22,56,63,75,82,29,91,41 -1 1188 95,42,21,97,32,64,79,63,43,96,59,16,22,41,88,91,18,56,29,75,19 -1 1189 59,52,88,56,75,14,82,94,54 -1 1190 32,45,11,52,22,85,96,76,41,79,21,88,91,55,63,43,64 -1 1191 66,55,15,11,76,45,42,85,97,32,64,63,96,59,16,22,52 -1 1192 76,45,21,97,79,59,16,22,88,18,56 -1 1193 66,19,94,11,27,33,54,78,36 -1 1194 11,63,81,43,22,96,85,33,16 -1 1195 29,96,43,53,97,85,78,16,14,79,18,63,75,19,22 -1 1196 41,52,88,91,29,75,72,84,73,94,54,13,27 -1 1197 69,84,33,54,13,18,73,81,75,14,93,94,82,36,56 -1 1198 32,64,22,43,96,55,42,15,65,11,71,97,76 -1 1199 56,29,75,78,36,53,14,72,82,84,92,73,94,68,54,13,27,69,81,71,66 -1 1200 65,85,32,91,29,75,78 -1 1201 13,93,69,81,71,66,55,15,76,45,95,85,32,63,43 -1 1202 66,96,79,59,16,11,97,69,33 -1 1203 95,11,64,16,66,76,55,88,15,97,65,41,96,42,21,43,52,79,22 -1 1204 52,88,91,29,78,36,14,84,73,94,54,27,69 -1 1205 97,32,64,79,63,43,96,59,16,22,41,52,88,56,29,75,78,14,72 -1 1206 13,81,54,76,15,85,33,55,97,71,92,45,95,11,65,27,42,73,93,68,21,69,94 -1 1207 91,29,78,19,36,53,14,73,94,54,27,81,71 -1 1208 45,95,63,88,56,96,42,75,85 -1 1209 96,88,78,53,72,82,94 -1 1210 72,75,82,59,36,56,16,18,78,41,52,22,29,92,94,68,73 -1 1211 91,18,56,29,75,19,36,14,72,82,84,92,94,54,13,93,69,81,71 -1 1212 73,94,54,13,93,27,69,71,33,66,11,76,65,95,42,21,85,97,32 -1 1213 84,92,81,33,66,76,45,95,85 -1 1214 27,33,15,11,76,45,65,95,32,63,59 -1 1215 78,88,96,14,41,72,64,36,84 -1 1216 82,92,73,93,69,81,66,55,15,45,65,42,21 -1 1217 68,54,69,81,33,66,95,85,79 -1 1218 91,22,59,82,84,29,18,56,96,14,94,53,43,75,73,52,88 -1 1219 27,94,93,53,56,75,78,84,72,41,82 -1 1220 82,65,45,54,15,53,71,13,55,68,66 -1 1221 54,13,93,27,69,81,71,33,66,55,15,11,76,45,95,42,21,85,97,32,64,79,63 -1 1222 93,76,97,69,15,92,73 -1 1223 64,79,96,18,56,29,75,78,19,53,72,82,84 -1 1224 84,92,73,94,68,54,13,93,27,69,81,71,33,66,15,11,76,45,65,95,42,21,85 -1 1225 36,22,52,16,78 -1 1226 14,72,82,84,92,73,94,68,54,13,93,69,81,71,33,66,55,15,11,76,45,65,95 -1 1227 56,92,54,84,27,73,13,93,19 -1 1228 33,84,11,14,92,72,71,95,94 -1 1229 85,32,55,76,33,59,79,66,95,11,63,21,96 -1 1230 27,75,71,92,72,68,36,93,69,53,14,19,81,82,54,56,18,29,33,13,94,78,84 -1 1231 69,94,13,85,97,95,93,81,64 -1 1232 71,21,63,96,81,22,85,95,76,97,59 -1 1233 65,63,96,76,42,95,71,16,55,11,21 -1 1234 92,41,94,56,68,84,22,19,91,88,53,14,54,73,72,75,13,18,36 -1 1235 36,53,14,72,82,84,92,73,94,68,54,13,93,27,69,81,71,33,66,55,15,11,76 -1 1236 65,81,13,33,11,76,93,42,45,73,15,55,95,84,92,85,71,21,54,66,27 -1 1237 59,16,22,41,88,91,56,29,75,78,19,36,14,82,84,92,73,94,54 -1 1238 94,27,42,33,84,72,81,93,82,71,65 -1 1239 66,21,15,33,32,27,55,54,95,69,76,71,73,65,42,85,81,45,97,13,68 -1 1240 53,27,93,19,82,33,81,69,36,54,94,71,72,66,73,76,15,14,13 -1 1241 29,75,19,36,53,14,82,84,92,73,94,68,54,13,93,27,69,71,33,66,55 -1 1242 14,88,82,36,78,91,63,43,22 -1 1243 22,91,18,56,29,14,92,73,93 -1 1244 85,59,41,88,18 -1 1245 63,43,59,16,41,88,56,29,75,19,14,82,84,92,73 -1 1246 97,32,64,79,63,43,96,16,22,41,52,91,29,78,19,36,53,14,72 -1 1247 95,33,65,13,72,76,92,14,55 -1 1248 64,65,52,78,91,97,96 -1 1249 71,78,84,56,27,93,36,72,94 -1 1250 69,66,93,72,55,15,92,13,45,68,11,27,73,54,76,95,84,94,71,42,33,65,82 -1 1251 36,72,92,73,94,68,27,69,81,33,66 -1 1252 22,41,52,18,29,75,78,53,14,72,82,84,92,94,68,54,93 -1 1253 43,96,16,41,52,88,91,18,29,78,19,36,53,14,72,82,84,92,73 -1 1254 97,21,27,15,76,96,95,42,45,11,81,32,79,33,69,59,63,85,43,65,64,66,71 -1 1255 54,81,21,93,68,85,97,73,76,55,11,42,95,69,33,66,71,45,65,15,92 -1 1256 32,42,64,15,18,45,79 -1 1257 15,66,84,54,45,93,95,33,69,65,55,82,27,71,68 -1 1258 73,53,27,56,36,14,69,66,54,68,92,75,29,94,93,13,78,84,72,33,19,82,81 -1 1259 15,65,27,32,69,45,73,71,85 -1 1260 64,22,91,36,72 -1 1261 66,55,11,76,45,65,95,42,21,85,97,64,79,43,96,22,41,52,88 -1 1262 66,68,69,79,45,55,11 -1 1263 75,78,19,36,82,84,13,81,71 -1 1264 71,55,65,95,85,97,32,64,79,96,59,22,41 -1 1265 53,14,72,82,84,92,73,94,13,93,69,81,33,66,55,15,11 -1 1266 72,68,27,94,14,71,91,56,81,78,73,82,18 -1 1267 15,69,96,93,95,21,33,55,42,97,63,85,11 -1 1268 64,71,45,27,97,94,93,15,65,55,68,42,54,81,66,69,21 -1 1269 78,36,14,72,82,92,73,94,68,54,13,93,69,66,55,15,11 -1 1270 68,84,78,56,27,75,13,69,82,18,14,93,81,54,71 -1 1271 76,45,65,21,85,97,64,79,63,43,59,16,22,41,52,88,18,56,29 -1 1272 97,88,52,43,36,18,96,29,16,41,64,59,75,56,63,19,72 -1 1273 78,53,14,72,82,84,73,68,54,13,27,66,55,15,11 -1 1274 96,16,22,52,88,18,56,29,75,78,19,36,53,72,82,84,92,73,68 -1 1275 88,56,59,63,29,14,43,32,97,53,96,52,91 -1 1276 63,95,85,18,16,78,22,32,91,97,21,88,41,43,29,56,64,52,19 -1 1277 14,72,82,94,54,13,93,27,69,33,66,55,15,76,45,65,95 -1 1278 96,29,75,41,18,73,94,68,56,36,59,52,16,91,53,88,92,82,84,22,72,14,78 -1 1279 95,32,79,91,18,29,19 -1 1280 95,42,21,85,97,32,64,79,96,16,41,52,91,29,75,78,19 -1 1281 11,93,94,68,81,71,69 -1 1282 96,92,75,82,56,22,91,14,88,29,41,94,19 -1 1283 66,55,15,11,45,65,95,42,21,85,97,32,64,79,43,96,59,16,22,41,88 -1 1284 66,15,95,42,21,85,32,64,63,96,59,16,22,41,52 -1 1285 22,52,55,59,41,45,33,64,16,76,96,43,79,11,95,32,63,65,85 -1 1286 41,19,18,95,96,16,52,85,88 -1 1287 59,16,41,32,63,64,21,55,97,42,95,91,15,79,65 -1 1288 63,16,96,97,95,91,88,42,21,85,15,18,64,32,22,79,76,11,65,59,45 -1 1289 93,21,66,69,32,15,97,55,64,45,54,79,27,33,71 -1 1290 14,72,82,84,92,94,54,13,93,27,69,81,71,66,55,15,11,45,65 -1 1291 66,55,81,71,69,84,36,29,27,13,82,33,14,73,68 -1 1292 27,29,81,68,36,92,78,53,54,71,14,66,93,72,19,55,13 -1 1293 32,91,53,18,96,56,64,59,21,43,78,19,63,36,79,22,88,16,85 -1 1294 16,75,22,96,78,41,52,53,91,84,64 -1 1295 81,68,78,88,73,82,56 -1 1296 92,73,94,68,54,13,93,27,69,81,71,33,11,45,95,42,21,85,97 -1 1297 73,85,11,27,54,95,65,42,93,32,81,33,66 -1 1298 13,93,55,15,64,63,43 -1 1299 72,82,84,92,73,94,68,54,13,93,27,69,81,71,33,66,15,11,76,45,65,95,42 -1 1300 54,13,93,27,69,81,71,66,55,15,11,76,45,42,21,85,97,32,64,79,63 -1 1301 27,53,19,41,75,88,56,54,92 -1 1302 66,27,15,92,84,94,55,11,81,95,42,73,65,45,76,21,71,85,54 -1 1303 43,14,52,41,36,88,92,18,82,72,96,94,53 -1 1304 85,97,64,43,16,22,52,78,14 -1 1305 75,36,53,72,13,33,15 -1 1306 59,52,42,19,64,88,36 -1 1307 78,97,29,36,18,53,91,16,14,79,43,19,85,63,59,22,75,88,64,52,96 -1 1308 53,73,93,71,55,76,65 -1 1309 93,69,81,71,15,45,21,85,97,63,96 -1 1310 56,92,14,88,93,73,84,52,72,36,82,27,78,19,18,69,75,68,53,91,29,94,54 -1 1311 81,84,92,15,68,27,42,95,13,11,69,66,76,33,72,55,71,45,82 -1 1312 71,66,15,45,65,95,42,21,85,97,32,64,43,22,41 -1 1313 19,73,54,27,81,71,76 -1 1314 92,68,82,36,18,91,93,41,19,75,27,84,53 -1 1315 82,84,92,73,94,54,13,93,27,81,33,66,55,15,11,76,45,65,21 -1 1316 43,41,16,96,14,29,64,22,78,36,18,88,56,53,72,52,59,75,82 -1 1317 72,82,84,92,73,94,68,54,13,93,27,69,81,71,33,66,55,15,11,76,45,65,42 -1 1318 43,59,16,41,36,84,94 -1 1319 13,93,69,81,71,33,66,55,15,11,76,45,65,95,42,21,85,64,79,63,43 -1 1320 16,52,18,29,78,14,82,92,73,54,13 -1 1321 97,64,43,41,29,14,72 -1 1322 18,29,75,78,19,36,53,14,72,82,84,92,73,68,54,13,27,69,33 -1 1323 71,42,65,63,97,76,54 -1 1324 55,43,45,16,85,79,65,11,64,59,42,63,97,33,96,95,41,22,66,15,76,71,32 -1 1325 75,19,53,14,73,54,27,69,81,33,66,55,15 -1 1326 11,76,45,65,85,97,64,79,63,43,96,16,22,52,88,91,56 -1 1327 88,52,29,42,59,56,36,22,97,91,41,19,85,79,21,96,32,18,78,16,75 -1 1328 65,95,42,21,85,32,64,79,63,43,96,59,16,41,52,88,91,18,56,29,75 -1 1329 71,33,66,55,15,11,76,45,65,95,42,21,85,97,32,79,63,43,96,59,16,22,41 -1 1330 21,85,16,41,52,91,18,56,29,75,53 -1 1331 56,45,85,43,75,41,21,22,59,52,63,42,32,29,64 -1 1332 85,95,75,91,52,96,88 -1 1333 33,97,66,32,13,76,65,42,94,81,64,21,11,95,93,55,45 -1 1334 88,91,18,56,29,75,78,19,36,53,14,72,82,84,92,94,68,54,13,93,27,69,81 -1 1335 22,16,65,59,95,33,66,81,63,64,76,42,97,43,15 -1 1336 81,15,69,82,65,84,14,92,33,13,45,68,72,55,93,94,11,71,95 -1 1337 27,68,91,56,19,13,93,69,92,73,81,18,78,82,29,88,72,53,36,14,75 -1 1338 78,36,85,59,16,97,52,42,64 -1 1339 79,63,96,59,16,22,41,52,91,18,56,75,78,19,36,14,72,82,92 -1 1340 15,69,32,43,13,66,93,45,79 -1 1341 97,64,79,63,43,59,16,41,52,88,91,18,56,29,75,78,19,36,53,14,72 -1 1342 29,92,68,84,52,75,91,56,19,22,53,88,72,36,18,82,41,73,14 -1 1343 84,59,22,18,16,64,91,53,88,63,29,72,19 -1 1344 27,56,72,29,92,81,53,69,73,36,94,54,68,82,78,33,71,18,13 -1 1345 68,92,53,91,36,29,18,78,72,84,73,94,13,93,81,19,27,88,54 -1 1346 21,13,68,94,33,45,11,54,71,66,69,55,73,65,81 -1 1347 93,29,13,19,92,36,91,52,88,78,56,73,27,84,69 -1 1348 56,75,72,82,73,81,66 -1 1349 85,73,68,21,54,76,95,55,45,94,32 -1 1350 66,45,65,95,42,97,64,43,22,41,52 -1 1351 63,32,43,59,85,41,95,42,88,55,96,22,97,91,65,76,11,21,16,15,64,45,52 -1 1352 45,43,11,66,55,64,63,93,95,69,81,13,21,79,15,97,27 -1 1353 64,32,88,79,41,22,18,75,56,96,91,21,45,29,59,52,85,63,95 -1 1354 69,81,71,33,15,11,76,95,42,85,97,64,79,43,96,59,16 -1 1355 15,68,13,66,71,93,11,94,19,92,36,69,27,82,81 -1 1356 43,71,96,41,85,97,76,63,66 -1 1357 95,97,64,96,43,79,93,85,69,66,32 -1 1358 22,41,52,88,91,18,56,29,75,78,19,36,53,14,82,84,92,73,94,68,54,13,93 -1 1359 82,76,72,14,71,33,19,36,93,13,73,92,94,53,84,55,11,81,54,69,66,15,27 -1 1360 72,32,19,22,56,59,36,16,91,96,82,88,29 -1 1361 79,65,95,85,11,52,56,42,21,91,16 -1 1362 16,22,56,29,78,19,36,53,84,92,73,94,68,54,13 -1 1363 96,84,19,53,94,88,68,72,36,52,59,92,22,56,78,14,16,41,75 -1 1364 22,52,91,18,19,14,68,54,93
diff --git a/2024/05/solution.rs b/2024/05/solution.rs
@@ -0,0 +1,56 @@ -1 1 use std::cmp::Ordering; -1 2 -1 3 #[path = "../lib.rs"] -1 4 mod lib; -1 5 -1 6 fn parse_input() -> (Vec<(u8, u8)>, Vec<Vec<u8>>) { -1 7 let mut state = true; -1 8 let mut rules = vec![]; -1 9 let mut updates = vec![]; -1 10 -1 11 for line in lib::iter_input() { -1 12 if line == "" { -1 13 state = false; -1 14 } else if state { -1 15 let (a, b) = line.split_once('|').unwrap(); -1 16 rules.push((a.parse::<u8>().unwrap(), b.parse::<u8>().unwrap())); -1 17 } else { -1 18 updates.push(line.split(',').map(|s| s.parse::<u8>().unwrap()).collect()); -1 19 } -1 20 } -1 21 -1 22 return (rules, updates); -1 23 } -1 24 -1 25 fn order(update: &Vec<u8>, rules: &Vec<(u8, u8)>) -> Vec<u8> { -1 26 let mut clone = update.clone(); -1 27 clone.sort_by(|a, b| { -1 28 if rules.contains(&(*a, *b)) { -1 29 return Ordering::Less; -1 30 } else if rules.contains(&(*b, *a)) { -1 31 return Ordering::Greater; -1 32 } else { -1 33 return Ordering::Equal; -1 34 } -1 35 }); -1 36 return clone; -1 37 } -1 38 -1 39 fn main() { -1 40 let (rules, updates) = parse_input(); -1 41 -1 42 let mut count1 = 0; -1 43 let mut count2 = 0; -1 44 -1 45 for update in updates.iter() { -1 46 let ordered = order(update, &rules); -1 47 if ordered == *update { -1 48 count1 += ordered[ordered.len() / 2] as u64; -1 49 } else { -1 50 count2 += ordered[ordered.len() / 2] as u64; -1 51 } -1 52 } -1 53 -1 54 println!("part1: {}", count1); -1 55 println!("part2: {}", count2); -1 56 }
diff --git a/2024/05/test.txt b/2024/05/test.txt
@@ -0,0 +1,28 @@ -1 1 47|53 -1 2 97|13 -1 3 97|61 -1 4 97|47 -1 5 75|29 -1 6 61|13 -1 7 75|53 -1 8 29|13 -1 9 97|29 -1 10 53|29 -1 11 61|53 -1 12 97|53 -1 13 61|29 -1 14 47|13 -1 15 75|47 -1 16 97|75 -1 17 47|61 -1 18 75|61 -1 19 47|29 -1 20 75|13 -1 21 53|13 -1 22 -1 23 75,47,61,53,29 -1 24 97,61,53,29,13 -1 25 75,29,13 -1 26 75,97,47,61,53 -1 27 61,13,29 -1 28 97,13,75,29,47