1
0
Fork 0

Added Day 5 Part 1

day8-work 5.1
Ishan Jain 1 year ago
parent 4a731b3d7f
commit 2fa5b3de29

@ -1,11 +0,0 @@
199
200
208
210
200
207
240
269
260
263

File diff suppressed because it is too large Load Diff

@ -1,8 +0,0 @@
forward 5
down 5
forward 8
up 3
down 8
forward 2

File diff suppressed because it is too large Load Diff

@ -1,13 +0,0 @@
00100
11110
10110
10111
10101
01111
00111
11100
10000
11001
00010
01010

File diff suppressed because it is too large Load Diff

@ -1,19 +0,0 @@
7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1
22 13 17 11 0
8 2 23 4 24
21 9 14 16 7
6 10 3 18 5
1 12 20 15 19
3 15 0 2 22
9 18 13 17 5
19 8 7 25 23
20 11 10 24 4
14 21 16 12 6
14 21 17 24 4
10 16 15 9 19
18 8 23 26 20
22 11 13 6 5
2 0 12 3 7

@ -1,602 +0,0 @@
50,68,2,1,69,32,87,10,31,21,78,23,62,98,16,99,65,35,27,96,66,26,74,72,45,52,81,60,38,57,54,19,18,77,71,29,51,41,22,6,58,5,42,92,85,64,94,12,83,11,17,14,37,36,59,33,0,93,34,70,97,7,76,20,3,88,43,47,8,79,80,63,9,25,56,75,15,4,82,67,39,30,89,86,46,90,48,73,91,55,95,28,49,61,44,84,40,53,13,24
38 80 23 60 82
25 35 28 47 39
40 0 30 48 76
32 41 49 69 4
13 42 89 20 12
76 89 13 5 98
87 48 2 59 20
37 88 41 24 57
16 85 31 73 95
70 11 93 30 27
81 55 41 85 33
67 97 71 90 52
19 3 79 66 14
49 96 94 26 25
60 46 51 82 9
33 60 26 83 21
91 7 39 19 41
88 9 82 69 29
93 79 12 34 11
43 65 64 54 20
55 75 71 30 14
42 67 3 73 13
78 72 51 96 99
95 10 84 0 31
91 47 66 33 34
11 72 55 52 79
94 34 53 61 40
8 31 49 68 71
37 45 15 78 57
21 88 65 24 56
65 59 4 41 69
44 61 23 46 42
10 68 37 54 25
82 2 13 71 93
87 90 89 57 74
75 70 40 68 30
5 28 58 52 19
80 96 53 43 63
33 60 66 64 56
88 74 9 8 36
58 38 46 42 89
98 85 17 51 2
28 92 22 64 53
27 97 43 10 54
75 56 71 67 79
75 86 11 4 39
14 80 41 26 2
97 18 96 5 28
44 68 54 88 35
57 98 74 21 19
45 16 4 23 63
44 37 99 21 85
2 82 58 10 84
0 47 53 33 20
93 19 39 72 8
5 25 24 32 44
59 37 95 88 89
68 69 8 96 99
16 0 7 92 94
65 15 55 66 31
65 14 92 66 69
43 45 30 8 26
87 47 18 82 76
33 80 67 35 22
38 62 84 96 52
39 45 15 57 53
35 47 70 4 0
50 17 65 78 3
2 7 28 36 42
99 48 27 83 72
52 47 81 44 92
35 86 36 71 29
57 15 1 95 7
68 77 6 3 31
20 13 58 89 93
2 56 27 4 64
69 91 88 58 15
10 92 61 63 6
84 93 79 25 90
16 31 55 46 53
23 42 93 12 30
47 99 38 0 14
6 90 72 70 21
62 61 96 87 22
5 55 51 28 17
42 12 58 95 92
67 89 88 87 47
32 72 11 83 97
55 16 66 57 29
54 64 96 2 36
72 47 69 68 12
23 4 37 79 13
52 5 59 58 70
44 3 21 93 76
97 0 35 9 71
87 49 55 18 94
68 32 99 50 37
15 3 80 90 42
83 12 41 21 58
91 89 74 45 51
5 60 13 46 47
18 54 33 26 0
28 43 83 31 20
12 75 34 36 4
76 2 80 70 79
16 66 25 97 20
52 23 80 74 90
31 81 95 28 36
99 8 50 57 98
11 0 30 35 39
12 33 36 90 30
59 66 77 25 46
88 24 4 41 50
18 52 37 75 43
68 49 56 84 87
27 80 51 25 93
4 41 61 30 67
68 47 15 20 50
78 66 97 54 84
35 1 23 89 14
82 51 38 80 75
35 79 43 54 3
73 13 23 25 59
27 64 47 62 66
83 0 7 4 20
67 2 72 23 81
46 1 26 85 25
31 65 52 16 14
15 4 91 59 19
83 60 10 89 90
62 63 13 96 6
24 91 27 29 81
38 47 50 26 36
79 73 22 45 58
15 54 76 46 70
42 69 91 34 9
96 28 61 41 56
15 5 59 47 50
79 27 4 0 21
51 44 26 95 32
9 38 6 58 99
89 69 96 33 73
26 20 32 12 27
67 29 79 81 59
66 45 24 36 68
99 52 1 66 64
15 76 36 75 83
48 7 95 71 6
31 28 65 14 69
10 38 46 74 96
15 12 59 98 54
18 75 48 65 96
57 38 2 86 5
0 87 93 23 94
50 29 13 91 14
55 83 80 45 52
44 31 64 25 71
15 85 50 91 54
9 29 78 74 23
73 82 75 58 98
63 56 29 80 25
53 52 91 18 24
73 83 7 11 87
79 47 41 59 78
13 51 9 21 20
28 35 98 80 63
30 60 34 99 32
11 61 15 73 24
55 74 42 38 26
22 17 43 75 71
97 53 65 75 51
96 74 81 69 71
76 5 49 60 41
86 64 90 92 30
6 95 85 93 40
65 90 20 4 82
41 17 48 27 77
84 60 94 15 10
55 64 49 35 16
36 8 23 58 59
74 19 70 35 82
77 21 84 50 25
18 61 12 28 54
0 3 72 85 87
78 4 57 38 16
1 63 0 38 23
31 76 73 22 35
8 72 44 25 45
70 33 29 37 21
49 50 85 57 61
37 50 51 12 93
83 80 87 6 88
4 95 62 20 41
78 56 76 49 11
72 7 52 14 28
72 34 61 19 68
2 67 88 7 55
8 11 20 85 47
42 54 46 48 64
38 84 3 76 13
32 34 55 90 64
16 1 94 48 91
96 45 27 58 63
98 20 43 73 10
87 52 49 8 24
6 9 31 37 29
45 55 12 23 67
86 0 81 49 1
18 25 7 15 50
32 34 90 99 69
38 73 44 17 52
7 81 85 62 98
68 66 86 21 76
24 94 50 46 67
36 54 55 96 8
90 39 51 5 99
33 20 14 1 81
94 74 38 95 35
37 96 62 57 84
65 11 55 46 69
26 29 75 3 55
33 83 68 94 47
37 41 85 50 57
76 39 5 81 20
18 24 92 71 87
89 92 39 70 59
40 35 23 62 47
7 16 22 34 71
15 97 86 91 3
54 26 56 44 29
93 91 66 8 78
60 48 51 6 57
69 35 87 65 73
53 32 94 49 89
88 34 23 84 59
41 57 7 37 0
79 2 86 82 9
25 69 14 78 33
4 28 85 8 61
97 72 88 1 54
24 84 65 28 60
99 86 53 93 22
17 67 10 29 54
27 0 96 20 36
25 3 62 89 33
10 28 78 82 96
21 11 51 27 97
41 63 72 58 89
7 0 76 67 19
52 38 87 18 13
73 35 49 44 79
76 47 94 53 82
11 61 88 86 83
81 60 33 99 72
84 26 40 8 54
31 50 40 9 80
6 59 51 55 12
2 34 93 38 13
11 82 21 20 72
89 83 60 53 79
42 54 52 13 85
99 76 87 44 26
36 50 0 59 82
10 73 29 72 27
79 31 64 51 91
68 49 65 94 3
46 2 6 78 93
63 31 53 27 60
21 67 99 22 95
24 9 18 76 33
31 95 91 18 37
83 2 78 75 8
77 33 9 12 22
24 50 80 93 39
21 47 35 70 94
2 44 55 60 89
45 18 46 72 11
47 83 56 52 65
4 19 21 14 34
25 80 16 48 36
53 92 71 14 95
98 51 54 15 82
48 87 99 46 83
42 86 11 43 18
72 28 37 93 78
84 79 30 28 98
33 80 65 82 25
35 29 46 13 60
90 69 52 78 64
55 94 0 48 56
42 71 26 93 82
47 36 31 89 69
65 5 41 1 32
74 17 64 11 68
23 54 61 99 37
97 4 22 2 38
8 17 79 99 20
44 80 28 57 32
18 86 94 77 70
11 93 75 49 3
80 48 85 89 23
30 50 94 46 18
59 9 81 42 8
40 15 90 26 31
0 51 39 36 65
93 63 15 87 25
90 44 65 23 66
22 27 20 17 45
42 62 14 0 57
46 4 10 35 96
44 43 60 80 86
48 45 78 40 19
54 98 32 17 69
25 11 14 34 63
26 20 59 0 74
0 59 87 45 30
33 36 1 38 43
67 37 74 2 70
85 22 44 56 23
68 24 75 92 10
90 83 87 85 67
95 24 94 6 40
77 15 52 68 66
22 20 38 29 79
3 10 62 13 16
9 49 87 13 18
85 39 77 82 86
96 44 12 72 78
59 81 21 94 88
17 93 23 56 45
57 53 80 98 22
23 45 5 26 77
6 28 4 25 83
59 55 58 75 92
72 36 99 82 97
74 33 53 49 86
9 50 66 7 78
29 36 71 26 87
54 82 84 47 46
39 30 56 22 27
6 49 84 14 43
41 44 29 18 79
93 56 77 64 26
15 13 96 9 80
50 54 75 99 24
58 49 91 69 63
16 55 19 18 84
13 79 42 56 0
36 27 60 74 53
66 61 62 54 15
85 22 43 79 90
77 21 75 66 15
25 68 69 35 78
88 3 18 50 7
8 27 52 76 72
12 56 0 45 33
13 81 25 24 41
80 65 9 32 95
18 44 36 68 99
78 29 17 38 43
57 41 77 5 10
98 30 70 23 46
9 19 11 34 74
43 33 32 95 14
65 8 68 50 88
49 93 95 1 55
57 92 58 0 90
69 15 23 62 56
54 37 6 96 11
26 80 70 79 88
46 76 82 77 19
4 50 83 88 69
67 44 59 25 21
40 12 90 33 24
63 78 9 71 86
74 82 88 25 15
61 83 7 6 98
41 9 84 13 72
78 26 8 60 20
4 58 29 93 11
46 60 44 55 63
91 19 58 56 85
2 32 67 26 41
43 61 25 73 21
86 14 71 9 6
38 72 58 17 77
25 79 78 5 67
81 70 50 85 73
7 69 14 80 6
93 51 60 42 29
82 28 99 66 27
35 97 91 90 80
87 7 55 78 17
83 36 98 37 72
58 43 51 49 56
93 72 61 19 74
81 44 27 25 12
96 10 26 69 99
94 23 63 52 8
71 95 17 54 70
28 21 33 5 26
45 86 63 92 69
77 43 99 20 56
89 40 36 30 53
41 32 94 17 58
83 63 92 93 51
11 86 67 3 61
81 50 16 90 89
0 75 31 22 77
82 74 37 57 39
49 87 33 0 13
54 38 71 85 32
79 84 89 4 61
34 14 69 47 3
35 12 59 1 55
95 37 72 73 85
0 69 50 75 55
51 24 90 71 78
66 86 23 40 6
34 27 43 14 65
46 11 41 86 21
31 82 38 23 53
66 52 39 6 1
16 95 36 0 69
28 54 91 99 60
32 80 4 3 97
26 63 89 52 22
25 91 43 96 68
71 42 78 34 56
0 82 5 69 19
69 60 58 19 1
91 59 54 52 11
43 46 27 2 7
89 57 42 88 31
93 94 37 96 29
72 8 29 64 75
16 45 0 39 46
77 6 88 40 27
92 78 21 63 51
24 12 90 94 47
5 41 63 42 73
37 80 91 18 50
3 24 53 17 49
6 86 30 46 69
16 97 75 88 93
97 60 66 77 74
1 72 41 69 94
30 8 98 33 43
99 63 95 91 11
56 65 70 12 0
47 39 37 79 48
60 31 19 10 53
14 36 25 38 2
76 89 32 1 20
65 72 91 71 66
87 72 13 30 75
50 80 97 17 63
99 9 53 69 86
20 57 92 66 21
31 42 4 98 0
38 89 15 91 95
94 20 13 64 25
37 9 98 10 44
28 97 5 78 32
99 41 82 22 87
97 16 42 87 15
19 70 82 66 30
79 5 67 75 91
27 26 56 63 17
51 99 13 59 35
85 33 3 34 5
72 74 88 81 10
4 64 61 59 8
78 42 90 27 80
14 12 52 76 1
67 92 61 33 60
82 91 85 76 56
39 37 6 65 63
32 51 45 14 98
73 17 8 46 70
97 75 33 9 23
85 27 15 3 26
4 34 36 10 77
68 82 37 32 86
58 88 95 87 99
70 19 67 42 31
81 6 10 95 18
85 50 90 25 56
16 94 7 78 24
59 88 93 77 4
92 25 16 75 67
97 71 53 32 90
6 70 69 55 40
77 20 72 84 73
34 35 38 98 76
24 96 27 39 3
54 26 12 65 60
67 62 43 98 14
15 95 2 82 33
64 17 86 0 63

@ -0,0 +1,503 @@
62,963 -> 844,181
58,85 -> 917,944
137,76 -> 137,347
453,125 -> 347,19
178,65 -> 977,864
447,360 -> 62,745
723,326 -> 156,893
47,497 -> 107,437
387,491 -> 340,491
58,477 -> 283,252
86,351 -> 562,827
215,172 -> 539,172
496,801 -> 496,63
546,412 -> 232,98
621,807 -> 481,807
471,20 -> 618,20
175,283 -> 175,467
19,283 -> 19,290
159,137 -> 159,11
593,181 -> 543,181
167,976 -> 929,976
730,782 -> 959,782
713,285 -> 713,880
583,144 -> 583,296
39,61 -> 961,983
778,81 -> 604,81
70,560 -> 70,889
85,129 -> 666,710
689,688 -> 632,688
76,52 -> 903,879
510,543 -> 22,55
510,935 -> 470,935
780,357 -> 780,602
440,349 -> 710,79
934,801 -> 412,801
979,25 -> 35,969
379,527 -> 379,76
243,524 -> 243,664
534,945 -> 11,422
198,367 -> 224,367
871,451 -> 456,451
226,231 -> 939,231
686,354 -> 740,300
543,68 -> 340,68
506,160 -> 319,347
177,25 -> 177,603
337,450 -> 724,450
421,519 -> 676,519
858,976 -> 179,297
236,222 -> 236,250
254,242 -> 254,626
859,243 -> 23,243
89,982 -> 979,92
58,758 -> 101,801
930,483 -> 587,826
667,717 -> 667,762
512,816 -> 845,816
17,501 -> 17,760
345,61 -> 847,61
531,840 -> 618,840
67,748 -> 262,748
548,461 -> 163,846
934,142 -> 169,907
119,931 -> 580,470
769,916 -> 457,604
587,458 -> 93,458
109,850 -> 768,191
225,129 -> 160,64
544,163 -> 544,476
304,594 -> 61,351
510,396 -> 510,741
772,210 -> 772,889
867,415 -> 721,269
466,266 -> 466,44
305,609 -> 305,237
563,962 -> 451,962
566,402 -> 28,940
889,717 -> 891,717
754,545 -> 313,545
930,976 -> 209,255
70,911 -> 692,289
737,37 -> 958,37
652,566 -> 720,634
776,551 -> 370,957
484,476 -> 820,476
119,420 -> 639,420
394,964 -> 394,221
340,767 -> 964,143
715,289 -> 481,55
236,389 -> 826,389
747,642 -> 33,642
583,351 -> 244,690
609,17 -> 609,680
460,365 -> 668,365
519,180 -> 929,590
206,45 -> 782,45
507,185 -> 386,306
16,12 -> 982,978
31,348 -> 320,348
54,975 -> 947,82
844,714 -> 870,714
677,965 -> 677,699
387,699 -> 387,26
329,479 -> 189,479
970,708 -> 538,708
565,434 -> 565,623
748,737 -> 748,497
255,984 -> 255,600
146,59 -> 932,845
191,929 -> 423,929
316,409 -> 802,409
208,560 -> 559,209
885,237 -> 135,987
477,486 -> 260,486
845,59 -> 845,811
225,369 -> 162,369
858,678 -> 858,362
162,972 -> 27,972
828,26 -> 283,571
670,48 -> 114,604
732,487 -> 620,487
570,575 -> 14,19
113,203 -> 162,154
374,702 -> 374,452
850,575 -> 535,575
841,133 -> 841,474
976,960 -> 642,960
177,428 -> 177,246
969,289 -> 589,289
787,842 -> 731,786
743,709 -> 336,709
15,914 -> 299,630
863,952 -> 17,952
586,889 -> 586,512
442,128 -> 436,128
633,367 -> 79,921
21,990 -> 257,990
829,297 -> 829,103
975,633 -> 879,633
946,887 -> 72,13
531,720 -> 123,312
84,954 -> 815,223
989,982 -> 257,982
669,417 -> 928,158
128,935 -> 87,976
692,850 -> 191,850
686,856 -> 686,259
135,396 -> 473,58
837,206 -> 629,206
751,227 -> 751,900
190,617 -> 190,502
850,265 -> 254,265
229,587 -> 325,491
980,747 -> 465,232
54,375 -> 439,375
737,844 -> 711,844
533,219 -> 123,629
232,805 -> 232,798
911,441 -> 911,160
80,294 -> 80,527
880,533 -> 590,533
674,84 -> 674,670
956,440 -> 554,842
24,939 -> 890,73
516,183 -> 145,554
71,584 -> 71,766
629,173 -> 643,187
34,360 -> 639,965
983,871 -> 983,682
986,590 -> 986,327
769,986 -> 130,986
392,192 -> 70,192
577,379 -> 635,379
243,664 -> 162,664
273,987 -> 273,192
251,548 -> 558,855
989,736 -> 989,611
400,697 -> 134,431
646,923 -> 646,841
768,782 -> 386,782
93,973 -> 939,127
489,91 -> 489,551
313,683 -> 248,748
986,61 -> 201,846
322,413 -> 737,413
567,716 -> 567,614
198,624 -> 439,624
402,198 -> 147,453
897,352 -> 897,298
773,379 -> 773,19
373,256 -> 931,814
690,796 -> 543,796
884,368 -> 464,368
136,864 -> 622,378
458,569 -> 458,254
491,462 -> 491,412
558,340 -> 73,340
980,52 -> 980,605
126,609 -> 390,345
437,659 -> 17,659
53,928 -> 982,928
389,591 -> 389,832
464,46 -> 464,754
646,680 -> 646,988
919,159 -> 109,969
334,75 -> 219,75
976,639 -> 976,685
264,773 -> 128,773
787,771 -> 699,771
415,124 -> 549,124
468,71 -> 468,701
815,121 -> 797,121
619,95 -> 610,104
886,294 -> 120,294
148,136 -> 148,314
816,971 -> 454,971
888,733 -> 431,733
59,836 -> 840,55
52,965 -> 962,55
989,982 -> 19,12
697,818 -> 185,306
883,638 -> 481,638
429,285 -> 170,26
516,507 -> 516,301
767,102 -> 61,808
764,793 -> 209,238
568,411 -> 261,718
706,622 -> 685,622
226,110 -> 790,674
544,429 -> 544,334
794,588 -> 794,792
804,738 -> 782,738
370,552 -> 370,189
960,275 -> 644,275
133,896 -> 686,896
12,986 -> 987,11
978,973 -> 69,64
92,465 -> 62,465
733,57 -> 18,57
110,845 -> 110,272
123,935 -> 123,499
37,960 -> 986,11
332,209 -> 344,221
237,279 -> 349,279
875,635 -> 875,420
552,174 -> 552,635
10,93 -> 853,936
909,82 -> 909,926
511,743 -> 511,830
223,974 -> 223,124
829,543 -> 11,543
307,671 -> 206,570
126,72 -> 956,72
528,903 -> 528,223
644,524 -> 952,216
734,324 -> 734,105
225,558 -> 225,159
667,122 -> 667,64
582,93 -> 582,509
817,932 -> 727,932
898,18 -> 79,837
12,987 -> 986,13
426,79 -> 722,79
496,884 -> 906,884
953,183 -> 953,508
360,881 -> 975,881
765,862 -> 579,862
14,55 -> 14,560
454,333 -> 290,333
19,479 -> 91,551
696,41 -> 56,41
329,203 -> 812,203
498,559 -> 498,636
822,852 -> 614,852
410,370 -> 410,624
829,415 -> 805,415
775,980 -> 204,980
705,780 -> 116,191
49,30 -> 988,969
324,199 -> 554,199
727,572 -> 157,572
212,693 -> 93,693
886,105 -> 152,105
239,834 -> 958,115
623,920 -> 623,523
389,225 -> 106,508
443,426 -> 443,108
129,770 -> 858,41
906,559 -> 392,559
44,793 -> 774,793
693,275 -> 693,738
623,434 -> 184,873
774,623 -> 774,895
140,187 -> 140,238
247,503 -> 45,301
575,365 -> 950,365
101,120 -> 646,120
42,682 -> 649,75
749,767 -> 516,534
551,53 -> 73,531
15,26 -> 885,896
749,15 -> 235,529
548,169 -> 784,405
458,564 -> 962,564
663,873 -> 678,873
349,773 -> 349,927
777,180 -> 637,320
238,306 -> 844,912
927,818 -> 652,543
404,673 -> 952,125
750,297 -> 18,297
926,958 -> 926,669
767,843 -> 767,833
151,136 -> 234,219
927,789 -> 468,330
593,361 -> 593,447
48,14 -> 954,920
282,972 -> 790,972
537,446 -> 202,446
847,125 -> 357,615
667,609 -> 299,609
820,987 -> 359,987
342,889 -> 595,889
692,414 -> 239,414
916,935 -> 70,89
289,884 -> 289,790
264,562 -> 373,562
850,24 -> 126,748
877,159 -> 213,823
702,607 -> 702,454
432,883 -> 432,260
530,387 -> 229,387
783,39 -> 783,933
757,775 -> 757,81
416,376 -> 474,376
220,462 -> 220,824
438,317 -> 421,317
403,312 -> 866,312
902,923 -> 204,923
345,33 -> 819,33
376,521 -> 549,521
172,320 -> 129,277
25,975 -> 976,24
730,108 -> 465,373
607,468 -> 737,598
376,55 -> 672,55
807,113 -> 974,113
345,804 -> 695,454
687,921 -> 650,884
262,743 -> 262,753
889,734 -> 499,344
424,727 -> 909,242
100,957 -> 100,832
558,958 -> 376,958
422,473 -> 539,356
424,463 -> 158,463
329,543 -> 816,543
300,74 -> 362,136
620,691 -> 620,312
215,727 -> 360,582
692,116 -> 618,116
945,722 -> 945,560
851,83 -> 450,484
692,424 -> 254,862
160,214 -> 160,405
937,101 -> 854,184
989,14 -> 18,985
256,275 -> 828,847
797,748 -> 509,748
521,148 -> 422,148
85,549 -> 85,807
689,688 -> 443,442
750,664 -> 648,562
51,616 -> 51,54
925,272 -> 925,696
284,560 -> 369,560
509,685 -> 509,559
985,157 -> 273,869
570,765 -> 614,721
62,981 -> 985,58
289,496 -> 289,104
752,232 -> 692,292
82,948 -> 683,948
15,20 -> 984,989
252,950 -> 252,132
930,659 -> 614,659
552,449 -> 798,695
850,894 -> 342,386
412,465 -> 412,383
249,616 -> 351,718
759,289 -> 613,289
673,347 -> 673,842
749,493 -> 449,493
378,468 -> 378,674
914,924 -> 890,900
514,56 -> 606,56
855,233 -> 979,233
170,756 -> 170,961
450,601 -> 450,87
868,192 -> 125,935
702,137 -> 231,608
109,36 -> 632,36
511,472 -> 511,945
208,884 -> 923,169
831,66 -> 146,66
435,133 -> 884,133
900,418 -> 916,418
957,104 -> 127,104
608,892 -> 608,40
554,782 -> 55,782
305,260 -> 305,712
942,143 -> 226,859
823,778 -> 317,778
228,415 -> 228,445
313,505 -> 669,505
43,539 -> 43,187
14,84 -> 743,813
687,101 -> 277,101
549,977 -> 549,392
21,637 -> 214,637
950,961 -> 104,115
778,831 -> 958,831
214,765 -> 579,765
586,42 -> 89,42
505,950 -> 505,115
144,734 -> 144,813
11,349 -> 11,681
49,336 -> 99,386
560,187 -> 560,551
678,602 -> 761,519
131,515 -> 411,795
957,835 -> 957,106
948,852 -> 948,990
541,946 -> 541,405
355,147 -> 724,516
644,476 -> 625,476
789,818 -> 207,236
259,57 -> 431,57
441,375 -> 441,34
774,121 -> 882,13
655,397 -> 188,864
467,432 -> 235,200
268,121 -> 268,842
975,14 -> 11,978
124,904 -> 935,93
401,582 -> 420,582
170,700 -> 523,347
20,681 -> 20,174
420,939 -> 173,692
61,933 -> 956,38
686,458 -> 686,939
780,561 -> 305,86
792,644 -> 792,780
632,550 -> 938,550
441,252 -> 841,252
789,59 -> 789,418
981,11 -> 278,714
264,41 -> 264,186
870,833 -> 605,568
160,905 -> 160,783
385,191 -> 385,403
774,791 -> 69,86
409,967 -> 409,173
868,41 -> 868,235
536,497 -> 949,497
757,119 -> 156,720
563,706 -> 883,706
124,482 -> 14,482
353,655 -> 904,104
194,868 -> 194,649
810,736 -> 748,736
815,578 -> 50,578
531,131 -> 241,131
18,972 -> 977,13
761,747 -> 73,59
650,701 -> 930,701
470,237 -> 470,740
333,803 -> 954,182
644,667 -> 235,667
943,766 -> 299,766
985,876 -> 985,503
170,924 -> 467,924
249,19 -> 981,751
462,666 -> 462,651
404,228 -> 877,228
174,440 -> 174,847
910,596 -> 672,596
430,663 -> 734,663
711,294 -> 69,294
193,302 -> 257,302
959,20 -> 13,966
171,561 -> 171,953
704,986 -> 29,311
285,886 -> 285,260
945,872 -> 531,458
265,748 -> 478,748
26,537 -> 26,851
205,210 -> 917,922
590,488 -> 241,139
536,179 -> 247,179

@ -0,0 +1,11 @@
0,9 -> 5,9
8,0 -> 0,8
9,4 -> 3,4
2,2 -> 2,1
7,0 -> 7,4
6,4 -> 2,0
0,9 -> 2,9
3,4 -> 1,4
0,0 -> 8,8
5,5 -> 8,2

@ -2,114 +2,79 @@
extern crate test;
const INPUTS: [&'static str; 2] = [
include_str!("../inputs/day4.sample.txt"),
include_str!("../inputs/day4.txt"),
include_str!("../inputs/sample.txt"),
include_str!("../inputs/input.txt"),
];
const WINNING_COMBINATIONS: [[(usize, usize); 5]; 5] = [
// Row wins
[(0, 0), (0, 1), (0, 2), (0, 3), (0, 4)],
[(1, 0), (1, 1), (1, 2), (1, 3), (1, 4)],
[(2, 0), (2, 1), (2, 2), (2, 3), (2, 4)],
[(3, 0), (3, 1), (3, 2), (3, 3), (3, 4)],
[(4, 0), (4, 1), (4, 2), (4, 3), (4, 4)],
];
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
enum BoardEntry {
Entry(u64),
Called(u64),
Null,
#[derive(Debug, Clone)]
struct LineSegment {
x1: usize,
y1: usize,
x2: usize,
y2: usize,
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
struct Board {
board: [[BoardEntry; 5]; 5],
sum: u64,
won: bool,
}
impl LineSegment {
fn generate_points(&self) -> Vec<(usize, usize)> {
if self.x1 == self.x2 {
let ymin = std::cmp::min(self.y1, self.y2);
let ymax = std::cmp::max(self.y1, self.y2);
impl Board {
fn mark_draw(&mut self, draw: u64) {
for row in self.board.iter_mut() {
for val in row.iter_mut() {
if let BoardEntry::Entry(v) = val {
if *v == draw {
self.sum -= *v;
*val = BoardEntry::Called(*v);
}
}
}
}
}
return (ymin..=ymax).map(|y| (self.x1, y)).collect();
} else if self.y1 == self.y2 {
let xmin = std::cmp::min(self.x1, self.x2);
let xmax = std::cmp::max(self.x1, self.x2);
fn is_winner(&self) -> bool {
for set in WINNING_COMBINATIONS.iter() {
let col_match = set
.iter()
.map(|&(x, y)| self.board[y][x])
.all(|entry| matches!(entry, BoardEntry::Called(_)));
let row_match = set
.iter()
.map(|&(x, y)| self.board[x][y])
.all(|entry| matches!(entry, BoardEntry::Called(_)));
if row_match || col_match {
return true;
}
return (xmin..=xmax).map(|x| (x, self.y1)).collect();
} else {
vec![]
}
false
}
}
fn cmds(input: &'static str) -> (Vec<u64>, Vec<Board>) {
let mut lines = input.split("\n\n").filter(|x| !x.is_empty());
let draws: Vec<u64> = lines
.next()
.unwrap()
.split(',')
.map(|x| x.parse::<u64>().unwrap())
.collect();
let mut boards = vec![];
for block in lines {
let mut bblock = Board {
board: [[BoardEntry::Null; 5]; 5],
sum: 0,
won: false,
};
for (i, line) in block.split('\n').enumerate() {
for (j, c) in line.split(' ').filter(|x| !x.is_empty()).enumerate() {
let num = c.parse::<u64>().unwrap();
bblock.board[i][j] = BoardEntry::Entry(num);
bblock.sum += num;
fn parse_input(input: &'static str) -> Vec<LineSegment> {
let lines = input.split('\n').filter(|x| !x.is_empty());
lines
.map(|line| {
let mut line = line.split(" -> ");
let start: Vec<usize> = line
.next()
.unwrap()
.split(',')
.map(|x| x.parse::<usize>().unwrap())
.collect();
let end: Vec<usize> = line
.next()
.unwrap()
.split(',')
.map(|x| x.parse::<usize>().unwrap())
.collect();
LineSegment {
x1: start[0],
y1: start[1],
x2: end[0],
y2: end[1],
}
}
boards.push(bblock)
}
(draws, boards)
})
.collect()
}
fn solution((draws, mut boards): (Vec<u64>, Vec<Board>)) -> u64 {
fn solution(coords: Vec<LineSegment>) -> u64 {
let mut answer = 0;
let mut grid = vec![vec![0; 1000]; 1000];
for draw in draws {
for board in boards.iter_mut() {
if board.won {
continue;
}
board.mark_draw(draw);
for coord in coords {
for (x, y) in coord.generate_points() {
grid[x][y] += 1;
}
}
if board.is_winner() {
answer = board.sum * draw;
board.won = true;
for row in grid {
for val in row {
if val >= 2 {
answer += 1;
}
}
}
@ -119,7 +84,7 @@ fn solution((draws, mut boards): (Vec<u64>, Vec<Board>)) -> u64 {
fn main() {
for input in INPUTS {
let input = cmds(input);
let input = parse_input(input);
let result = solution(input);
println!("Result {}", result);
}
@ -127,7 +92,7 @@ fn main() {
#[bench]
fn solution_bench(b: &mut test::Bencher) {
let input = cmds(INPUTS[1]);
let input = parse_input(INPUTS[1]);
b.iter(|| {
let result = solution(input.clone());
test::black_box(result);

Loading…
Cancel
Save