feat: solve day 22 part 1 & 2
This commit is contained in:
parent
c59575aa99
commit
87cfe7a587
420
input/22.txt
Normal file
420
input/22.txt
Normal file
@ -0,0 +1,420 @@
|
||||
on x=-8..36,y=-13..38,z=-30..18
|
||||
on x=-21..27,y=-43..1,z=-28..20
|
||||
on x=-43..8,y=-35..16,z=-21..29
|
||||
on x=-14..33,y=1..46,z=-33..20
|
||||
on x=-20..24,y=-32..18,z=-44..3
|
||||
on x=-31..13,y=-24..24,z=-13..41
|
||||
on x=-34..17,y=-24..25,z=-32..21
|
||||
on x=-21..29,y=-40..14,z=-34..19
|
||||
on x=-11..41,y=-46..3,z=-22..25
|
||||
on x=-13..41,y=-20..32,z=-26..21
|
||||
off x=34..48,y=-8..6,z=-47..-32
|
||||
on x=-36..16,y=-25..29,z=-42..10
|
||||
off x=-27..-10,y=20..38,z=-32..-15
|
||||
on x=-43..7,y=-3..46,z=-13..41
|
||||
off x=-21..-10,y=-5..7,z=-34..-24
|
||||
on x=-47..2,y=-26..19,z=-30..19
|
||||
off x=2..18,y=39..48,z=34..49
|
||||
on x=-29..21,y=-28..19,z=-14..39
|
||||
off x=-12..1,y=-15..-6,z=-12..5
|
||||
on x=-33..11,y=-5..40,z=-19..34
|
||||
on x=4839..37119,y=-77870..-65928,z=-31721..6883
|
||||
on x=-65074..-45532,y=-76161..-55995,z=18422..28809
|
||||
on x=-19046..7513,y=65962..85040,z=-50719..-38025
|
||||
on x=31203..42162,y=42926..64021,z=25628..44570
|
||||
on x=-23080..-9369,y=20501..49221,z=70364..78911
|
||||
on x=11385..44807,y=56888..76379,z=2197..23866
|
||||
on x=17447..25479,y=-59366..-48603,z=-63221..-43855
|
||||
on x=34953..56079,y=-72829..-39611,z=24187..47582
|
||||
on x=3553..21317,y=-69977..-55642,z=38791..44119
|
||||
on x=-57043..-43446,y=-62985..-45094,z=-46766..-23033
|
||||
on x=-66953..-46125,y=7548..20111,z=36275..67691
|
||||
on x=48156..52160,y=-57159..-48177,z=-27750..-17451
|
||||
on x=-8199..9720,y=-71971..-52302,z=33698..55920
|
||||
on x=-26740..-21116,y=-47606..-32902,z=-83414..-51593
|
||||
on x=35163..49358,y=-57959..-36064,z=29918..57157
|
||||
on x=-7610..15882,y=31069..43205,z=50534..76280
|
||||
on x=-38397..-8880,y=50925..60954,z=38695..68136
|
||||
on x=-22971..3262,y=63662..94550,z=-23890..-3669
|
||||
on x=56919..85184,y=-24246..-10978,z=-45500..-14062
|
||||
on x=70576..93606,y=-3591..16458,z=12386..39202
|
||||
on x=-40810..-32824,y=46441..70619,z=-50354..-41110
|
||||
on x=-44090..-21796,y=-49222..-29203,z=-78625..-53659
|
||||
on x=4179..22689,y=62208..95078,z=-32906..-2773
|
||||
on x=41435..58226,y=-69091..-52534,z=11220..22466
|
||||
on x=44027..56489,y=-61228..-40839,z=24716..49802
|
||||
on x=58856..89381,y=-24787..-6210,z=-38387..-21495
|
||||
on x=31249..66391,y=-338..29577,z=-73616..-43844
|
||||
on x=-69236..-35435,y=-56932..-41334,z=10510..37433
|
||||
on x=-30489..7293,y=23785..50236,z=-75453..-69050
|
||||
on x=-44614..-24138,y=-14044..4035,z=-80479..-57806
|
||||
on x=75190..96327,y=-32..21796,z=-19982..654
|
||||
on x=-57769..-43737,y=-43364..-27692,z=26689..48069
|
||||
on x=-33705..-1437,y=-50304..-33797,z=-65845..-40680
|
||||
on x=-78406..-40654,y=42549..59337,z=-28001..-11767
|
||||
on x=63318..88223,y=-16500..-422,z=7937..12185
|
||||
on x=-86159..-71499,y=10841..35268,z=-23323..5521
|
||||
on x=-69927..-48219,y=-54626..-22479,z=-44943..-15579
|
||||
on x=-43768..-13251,y=-64205..-52022,z=-49650..-31322
|
||||
on x=-66574..-54884,y=17683..44711,z=31164..56138
|
||||
on x=72035..82108,y=-3813..10230,z=-2284..15893
|
||||
on x=37334..58441,y=51079..61499,z=18464..27016
|
||||
on x=-32585..-16545,y=55965..89671,z=8302..34498
|
||||
on x=-26529..3377,y=-29123..-20453,z=56842..83561
|
||||
on x=32146..54092,y=-35416..-9066,z=51048..69716
|
||||
on x=-25194..7525,y=-78242..-62921,z=-50241..-35907
|
||||
on x=51949..62077,y=39590..56347,z=-31891..-19806
|
||||
on x=2190..18191,y=-26549..-4898,z=68835..81165
|
||||
on x=37501..59670,y=-54043..-24397,z=18589..44711
|
||||
on x=53124..84011,y=-37865..-20884,z=12749..28642
|
||||
on x=11469..29443,y=-87115..-71637,z=16152..46608
|
||||
on x=-11034..2944,y=3487..21169,z=74689..82882
|
||||
on x=19100..25746,y=-61128..-36379,z=43441..71029
|
||||
on x=5600..38744,y=-7945..6683,z=66027..94407
|
||||
on x=68461..75284,y=8717..26700,z=15336..51188
|
||||
on x=-61283..-47763,y=2607..39967,z=37842..70865
|
||||
on x=-45729..-24681,y=-21605..549,z=63515..88818
|
||||
on x=25798..44610,y=47822..73500,z=-60521..-23985
|
||||
on x=-95305..-75665,y=-26118..-5350,z=-12906..15434
|
||||
on x=33757..57435,y=42302..67655,z=-54184..-23134
|
||||
on x=2994..22115,y=-88253..-58648,z=28386..48449
|
||||
on x=-62548..-49059,y=-15737..4824,z=41511..53585
|
||||
on x=67083..78970,y=4211..28190,z=-48739..-19705
|
||||
on x=-78667..-54791,y=-46045..-26836,z=24727..53046
|
||||
on x=54721..85885,y=-8372..21818,z=29648..43363
|
||||
on x=69627..90635,y=-20694..-18387,z=7933..32742
|
||||
on x=-65893..-37568,y=-11991..15161,z=-65829..-60748
|
||||
on x=-57395..-46236,y=-2048..13172,z=-70802..-56233
|
||||
on x=-22043..3715,y=57559..88108,z=-45280..-34414
|
||||
on x=-74828..-53038,y=46478..58430,z=-19255..10363
|
||||
on x=13806..37110,y=33798..59217,z=-64375..-61548
|
||||
on x=61..4442,y=-14980..13830,z=-81808..-73388
|
||||
on x=-44428..-22458,y=-30625..-10622,z=-66261..-46437
|
||||
on x=61389..79075,y=-55043..-35044,z=-31620..-5849
|
||||
on x=1257..22335,y=-92002..-65926,z=23483..35032
|
||||
on x=-66071..-40860,y=-871..30120,z=47036..74284
|
||||
on x=18446..32639,y=-16466..3221,z=-89695..-56843
|
||||
on x=-4829..18965,y=-25609..-3292,z=-83328..-71836
|
||||
on x=-51528..-12497,y=-36433..-10612,z=67126..82588
|
||||
on x=-56346..-40152,y=3846..23474,z=44670..66145
|
||||
on x=-31862..-23691,y=-90559..-67842,z=-35278..-9721
|
||||
on x=-82636..-55468,y=7393..29473,z=20855..53140
|
||||
on x=-23503..-10904,y=-71671..-43413,z=39526..74530
|
||||
on x=-24286..-10051,y=42535..69016,z=47293..59326
|
||||
on x=27107..36075,y=-68197..-63740,z=-38325..-23137
|
||||
on x=49700..61611,y=-63668..-46517,z=-32392..-27815
|
||||
on x=8270..28696,y=50213..72279,z=-43392..-25307
|
||||
on x=39641..61962,y=-20666..-417,z=-81881..-48826
|
||||
on x=12571..33176,y=-14528..8290,z=-89384..-70716
|
||||
on x=-43871..-13117,y=-39900..-7197,z=59502..90659
|
||||
on x=-36035..-2433,y=65658..84996,z=-33491..-14374
|
||||
on x=63543..80825,y=-6748..-2651,z=-58258..-19329
|
||||
on x=28713..46264,y=3886..14439,z=-90710..-60973
|
||||
on x=-22187..2425,y=54328..74307,z=28523..62729
|
||||
on x=-44284..-19454,y=-77265..-62483,z=-24166..4845
|
||||
on x=-3490..10486,y=-85697..-76511,z=5917..20496
|
||||
on x=-24962..2419,y=11207..27000,z=61253..96386
|
||||
on x=52442..59482,y=-41524..-22315,z=-68202..-48780
|
||||
on x=-34407..5096,y=-92571..-67584,z=-35286..-2042
|
||||
on x=11100..17929,y=-19300..4676,z=58434..88671
|
||||
on x=60823..86913,y=-1593..13586,z=-3558..26423
|
||||
on x=-54273..-37709,y=28937..38483,z=-62444..-46473
|
||||
on x=-3663..6115,y=-67350..-58585,z=-59265..-39858
|
||||
on x=-33708..-26120,y=62411..80951,z=-50679..-28890
|
||||
on x=54088..78257,y=-30377..5547,z=-54962..-42452
|
||||
on x=-51040..-15145,y=-75083..-71823,z=-7664..22918
|
||||
on x=-48121..-39943,y=59649..86399,z=-19305..14422
|
||||
on x=19442..39564,y=65372..89430,z=-9881..23180
|
||||
on x=-5638..-504,y=51726..81303,z=34865..52668
|
||||
on x=51177..68510,y=-55462..-49393,z=-1676..34025
|
||||
on x=-39225..-13934,y=-44638..-21274,z=-69663..-61721
|
||||
on x=-34256..-22300,y=-79410..-50706,z=18119..42580
|
||||
on x=28326..43362,y=-65829..-50909,z=-58284..-26939
|
||||
on x=-60717..-46351,y=16976..39679,z=-47682..-36099
|
||||
on x=-8972..-1099,y=-52473..-25319,z=-86121..-52942
|
||||
on x=-61000..-39159,y=49997..78225,z=-23148..1003
|
||||
on x=58182..82981,y=44518..56895,z=3777..5095
|
||||
on x=6734..28162,y=-86696..-58568,z=-24484..-2036
|
||||
on x=58887..76977,y=-39238..-25941,z=39846..46017
|
||||
on x=24847..30203,y=-67085..-34859,z=41924..66616
|
||||
on x=20441..43585,y=-92938..-64316,z=-31009..-1794
|
||||
on x=-80785..-61417,y=-38919..-35032,z=-36530..-28271
|
||||
on x=59377..75712,y=43560..68823,z=-22599..-1614
|
||||
on x=-1700..13850,y=-4069..2130,z=63749..86953
|
||||
on x=-4952..16715,y=41882..73610,z=-54756..-52305
|
||||
on x=51595..59284,y=-24107..-4393,z=-72363..-43891
|
||||
on x=-27807..-3926,y=26851..45198,z=49346..82929
|
||||
on x=12390..34498,y=63224..91240,z=-5214..800
|
||||
on x=10873..42647,y=-46607..-10385,z=65246..87490
|
||||
on x=-62055..-38470,y=-21876..173,z=-62808..-40393
|
||||
on x=20224..48752,y=-38586..-16511,z=-85733..-52651
|
||||
on x=55784..81552,y=-5619..16327,z=34077..51185
|
||||
on x=-3455..10014,y=-85026..-65575,z=-26623..-11858
|
||||
on x=-35708..-27267,y=-45850..-19818,z=-67455..-45823
|
||||
on x=41827..53199,y=41230..65698,z=27015..50197
|
||||
on x=-6012..4252,y=-72302..-66695,z=36125..47997
|
||||
on x=49528..64452,y=-58166..-30694,z=-13199..4956
|
||||
on x=9888..29239,y=-68554..-54138,z=18724..56782
|
||||
on x=-68870..-53794,y=-58759..-22882,z=7742..40403
|
||||
on x=6972..17377,y=-20708..-6722,z=-82963..-69421
|
||||
on x=20367..25651,y=58345..91004,z=-20550..10387
|
||||
on x=25694..35176,y=22099..43134,z=-70032..-63879
|
||||
on x=-45952..-11194,y=-81779..-67800,z=8182..23824
|
||||
on x=62509..80195,y=-21937..-2975,z=5609..20751
|
||||
on x=-24032..-6383,y=24506..45121,z=59690..78556
|
||||
on x=-51599..-38434,y=30719..51414,z=36050..73737
|
||||
on x=58822..68897,y=7741..15890,z=-51938..-32193
|
||||
on x=-15039..6906,y=-65212..-41797,z=30699..55624
|
||||
on x=60817..85926,y=27886..55706,z=-8663..11830
|
||||
on x=15206..34437,y=30959..54489,z=57564..71609
|
||||
on x=35392..53432,y=22100..27886,z=-71711..-46618
|
||||
on x=-63155..-33316,y=2506..33937,z=53928..70435
|
||||
on x=39063..66505,y=25641..56117,z=-52530..-39376
|
||||
on x=-25070..-14807,y=-94850..-59369,z=-15595..12932
|
||||
on x=-83108..-73279,y=-39576..-1760,z=-6745..24559
|
||||
on x=-18659..1714,y=65445..79434,z=39458..61966
|
||||
on x=-73934..-43865,y=-53154..-30276,z=-31417..-14432
|
||||
on x=8399..36820,y=-5066..-746,z=62811..89658
|
||||
on x=51461..58467,y=21289..47244,z=-48496..-34141
|
||||
on x=-31677..-15125,y=65258..94618,z=-11983..21397
|
||||
on x=-59850..-45075,y=46471..73073,z=33142..52196
|
||||
on x=-38957..-29818,y=40316..50247,z=45129..64145
|
||||
on x=-17719..3143,y=-99029..-70583,z=-15275..-3260
|
||||
on x=-20122..-5655,y=-68173..-47607,z=27797..47630
|
||||
on x=-77283..-55700,y=852..31360,z=32087..48207
|
||||
on x=28846..48388,y=63096..85300,z=-30595..-3844
|
||||
on x=-82363..-49209,y=-51315..-42669,z=-5472..13974
|
||||
on x=-33522..-24893,y=54281..60638,z=-48809..-29636
|
||||
on x=-72223..-48831,y=-46560..-25806,z=36517..53330
|
||||
on x=-49478..-43471,y=-11706..10889,z=-80068..-54930
|
||||
on x=-55073..-36710,y=66679..68786,z=-21283..-7896
|
||||
on x=23706..37729,y=15047..43923,z=-72897..-65979
|
||||
on x=17181..28459,y=62283..83521,z=-31363..-8226
|
||||
on x=-16143..9900,y=27489..59106,z=59096..76947
|
||||
on x=3206..10671,y=-14400..10991,z=-95245..-69938
|
||||
on x=56347..81552,y=-25300..-8107,z=19105..50434
|
||||
on x=-78103..-66259,y=-37451..-32307,z=-33713..-2616
|
||||
on x=30350..59481,y=29541..51913,z=39794..66802
|
||||
on x=-6369..27626,y=29467..54642,z=-87761..-63038
|
||||
on x=-75910..-44075,y=8881..33348,z=39378..53195
|
||||
on x=-93870..-77120,y=-4549..11366,z=10630..21270
|
||||
on x=63828..86196,y=7557..26186,z=-31651..-14082
|
||||
on x=-45560..-23421,y=-57108..-50195,z=-46356..-35654
|
||||
on x=27703..38747,y=-64773..-61912,z=-50641..-19460
|
||||
on x=-30255..-26778,y=-36213..-16183,z=-72571..-68332
|
||||
on x=74470..78456,y=-25411..13731,z=9282..44191
|
||||
on x=60166..74998,y=-59027..-34355,z=23594..36628
|
||||
on x=-34949..-18916,y=48964..60747,z=-65291..-40385
|
||||
on x=41085..68564,y=-51507..-22592,z=-48642..-22967
|
||||
on x=-61218..-38261,y=-64826..-57227,z=-40284..-2183
|
||||
on x=-63449..-37989,y=-39697..-27482,z=-74092..-51129
|
||||
on x=9363..31975,y=55098..78687,z=-52413..-40226
|
||||
on x=-84308..-56837,y=-40246..-7996,z=-36362..-18607
|
||||
on x=-72651..-66165,y=9333..15666,z=25597..51574
|
||||
on x=17401..47978,y=9920..42401,z=-70754..-58041
|
||||
on x=-63217..-51951,y=-12225..11075,z=44022..66562
|
||||
on x=29053..49545,y=-84344..-63035,z=-6015..22142
|
||||
on x=-71933..-39944,y=23397..41453,z=-51539..-33412
|
||||
on x=37569..61597,y=43450..53548,z=22047..45919
|
||||
on x=8968..35041,y=59910..84105,z=-52586..-33885
|
||||
on x=-57379..-27352,y=-41555..-18843,z=54181..60564
|
||||
off x=-14944..13704,y=-58332..-46987,z=52838..63073
|
||||
on x=-73816..-53118,y=-14780..2920,z=-64505..-39848
|
||||
off x=-39460..-353,y=-51496..-30749,z=46316..63357
|
||||
on x=-85117..-60538,y=-36842..-15322,z=-52531..-16603
|
||||
off x=7991..31176,y=-73583..-52023,z=32437..48771
|
||||
off x=8515..30142,y=-77709..-62651,z=17831..46909
|
||||
on x=-18303..17378,y=-21032..-6623,z=64638..88783
|
||||
on x=7339..25764,y=-90496..-66449,z=-38251..-26490
|
||||
off x=-70223..-46889,y=4443..35356,z=-42714..-28833
|
||||
on x=-77805..-50387,y=43932..53069,z=-12411..-5379
|
||||
off x=-72499..-45397,y=-53542..-41435,z=-3491..21042
|
||||
on x=10885..19988,y=-41497..-7678,z=55702..84296
|
||||
off x=50943..59682,y=9775..27593,z=41418..52240
|
||||
on x=-5512..31721,y=74926..78902,z=-24035..-8858
|
||||
on x=54750..82645,y=29855..45661,z=8586..29144
|
||||
off x=-78864..-55077,y=6925..16113,z=-59924..-27087
|
||||
off x=9337..38246,y=60440..66216,z=-47033..-39339
|
||||
on x=-31403..-21142,y=-21908..-8535,z=-77524..-68441
|
||||
off x=-48840..-15847,y=-67498..-39602,z=-67358..-37763
|
||||
off x=-19834..7437,y=-20737..16009,z=-93797..-74007
|
||||
off x=-61152..-39838,y=52890..67543,z=-394..22101
|
||||
on x=-80448..-55372,y=1276..22349,z=-50814..-32755
|
||||
off x=44370..73647,y=-55877..-35324,z=26221..47034
|
||||
on x=46532..57702,y=-13840..3895,z=-69576..-50251
|
||||
off x=-73517..-57384,y=31351..41680,z=15220..23322
|
||||
on x=31166..41044,y=-51591..-33043,z=-75269..-52116
|
||||
on x=-56761..-45567,y=-54768..-32061,z=-60838..-46237
|
||||
on x=-75017..-54994,y=-28885..-27479,z=-19257..8285
|
||||
off x=17363..19964,y=-1700..23699,z=65227..80609
|
||||
on x=-72438..-53153,y=33395..60653,z=-27435..1947
|
||||
on x=67153..86947,y=-39064..-13890,z=-24067..-7025
|
||||
off x=-23935..-7756,y=54756..73703,z=-57803..-30333
|
||||
on x=-94142..-68468,y=-38295..-14233,z=-2486..8555
|
||||
off x=-16941..5265,y=64250..78153,z=7680..25578
|
||||
off x=-96513..-66230,y=-4640..29008,z=-10817..10499
|
||||
on x=-47541..-35822,y=-56040..-37593,z=25295..56913
|
||||
off x=32696..49773,y=-77640..-67246,z=-32741..-2933
|
||||
on x=60031..96079,y=-10285..24947,z=-23593..3651
|
||||
off x=60668..82205,y=4890..26483,z=-30306..7631
|
||||
off x=52550..78640,y=-65700..-48087,z=-12117..8780
|
||||
off x=-30793..-2678,y=-45649..-34548,z=66170..81785
|
||||
on x=3954..24104,y=-77505..-64791,z=-47133..-20347
|
||||
off x=-60663..-48533,y=30758..43913,z=38074..52867
|
||||
off x=29598..55875,y=62594..74543,z=-175..18742
|
||||
on x=7268..15664,y=64342..81253,z=-39177..-11209
|
||||
off x=50616..71417,y=-7637..-11,z=-65773..-35786
|
||||
off x=-85212..-54719,y=-45697..-20353,z=-40912..-7219
|
||||
off x=51683..61140,y=-16896..8191,z=56876..63036
|
||||
on x=63796..81879,y=-6590..10629,z=-17826..-13338
|
||||
off x=-12462..19923,y=24812..46240,z=58581..91722
|
||||
off x=60238..81783,y=9597..26586,z=9422..30485
|
||||
on x=-50156..-28362,y=28748..53048,z=51469..66900
|
||||
off x=69194..89229,y=-1108..23127,z=25684..56099
|
||||
off x=-84146..-57909,y=-17501..11445,z=30089..62555
|
||||
on x=31618..49715,y=37591..62455,z=43947..51429
|
||||
off x=-3586..19186,y=69304..92938,z=-20587..-9138
|
||||
on x=-61199..-46598,y=35967..60395,z=-14556..4590
|
||||
off x=-10913..14231,y=-30261..1009,z=-84245..-76301
|
||||
off x=60186..89222,y=-3692..33740,z=-25990..-8108
|
||||
on x=36727..54779,y=43724..59581,z=27937..65959
|
||||
on x=31209..44945,y=42559..57599,z=39510..49135
|
||||
on x=-3245..14976,y=-72819..-52510,z=36034..64484
|
||||
on x=440..28782,y=-11547..4495,z=-98435..-74377
|
||||
on x=-18198..10563,y=-81024..-73403,z=-17198..5796
|
||||
on x=12612..21502,y=-51647..-31132,z=-59647..-51386
|
||||
on x=29495..52571,y=11017..19714,z=46828..68700
|
||||
on x=9809..37561,y=-30853..-19860,z=-83128..-60062
|
||||
off x=67691..79085,y=-31154..3105,z=-37577..-17350
|
||||
on x=72836..97051,y=-31514..-15790,z=-29704..1797
|
||||
on x=-87609..-69341,y=-18788..-2505,z=-12297..-10409
|
||||
on x=20443..43548,y=-62320..-37522,z=38977..60544
|
||||
off x=-38964..-26257,y=58268..79198,z=22960..47406
|
||||
on x=-73221..-48099,y=-41579..-12744,z=41233..55998
|
||||
on x=39815..61968,y=-25816..2853,z=-84604..-48176
|
||||
off x=43328..47847,y=50145..81706,z=-20854..-17930
|
||||
on x=42026..55667,y=2815..18320,z=-71420..-56114
|
||||
on x=-15046..7093,y=-2067..6846,z=-87205..-62415
|
||||
off x=-47170..-12892,y=-70768..-49876,z=15359..40080
|
||||
off x=-2457..10461,y=30411..42007,z=-81116..-70962
|
||||
off x=52522..85711,y=-59582..-35527,z=-16966..8482
|
||||
on x=-46197..-25909,y=47222..78261,z=-50850..-32047
|
||||
off x=19590..34572,y=72339..87567,z=-5750..28633
|
||||
off x=47115..83953,y=-18319..-1527,z=36796..53774
|
||||
off x=-83826..-54856,y=-42413..-32997,z=3733..27276
|
||||
on x=-56233..-44250,y=49602..74071,z=22314..30759
|
||||
off x=63420..86367,y=-10839..17688,z=-58166..-41413
|
||||
off x=-52818..-25004,y=30897..65041,z=34334..65736
|
||||
off x=-37943..-1255,y=-31595..-17688,z=-79911..-66116
|
||||
off x=-53072..-34686,y=-74173..-48306,z=29767..56394
|
||||
on x=-52788..-31825,y=-32369..-19858,z=48905..63632
|
||||
on x=-1350..29555,y=-19635..-7074,z=-87305..-65879
|
||||
off x=-20803..-15829,y=21850..48686,z=-81910..-49506
|
||||
off x=6419..36337,y=-72720..-64997,z=9779..35669
|
||||
on x=-27678..-5611,y=-63057..-58292,z=-49298..-38857
|
||||
on x=-25232..-8560,y=-36175..-7964,z=-79251..-62089
|
||||
on x=3484..8094,y=60295..74830,z=19467..40876
|
||||
on x=25344..49707,y=55996..61107,z=27573..40860
|
||||
off x=47919..70340,y=-21803..-8394,z=-48605..-36363
|
||||
off x=-46037..-33978,y=47245..79330,z=-37903..-25173
|
||||
off x=-71914..-46814,y=2394..17414,z=-64968..-46103
|
||||
on x=19065..32293,y=-81832..-70280,z=-14026..1070
|
||||
off x=-38512..-31573,y=47413..61535,z=37582..62106
|
||||
on x=48305..70579,y=-62027..-50478,z=-15171..1424
|
||||
off x=-75249..-57569,y=-35309..-10651,z=33081..55723
|
||||
on x=25348..44691,y=-63608..-38147,z=40069..50336
|
||||
off x=29076..42828,y=43230..71477,z=-50728..-30676
|
||||
off x=-79502..-64190,y=-38572..-26384,z=-15092..12199
|
||||
on x=-23179..-7624,y=48807..73012,z=33610..40354
|
||||
on x=-3592..8389,y=60961..82397,z=-49081..-28054
|
||||
off x=51476..83453,y=28705..56528,z=-12926..1967
|
||||
on x=-27187..-19195,y=-82395..-52994,z=21622..43848
|
||||
off x=-90506..-68537,y=-9823..6672,z=26454..41372
|
||||
off x=44140..77814,y=-53839..-33067,z=19437..52037
|
||||
off x=70486..89103,y=-32008..-18702,z=-30582..-3135
|
||||
off x=9812..37159,y=-13683..5581,z=67454..90785
|
||||
on x=55516..76011,y=29943..54363,z=-35505..-8311
|
||||
on x=18107..53089,y=40166..76403,z=-46033..-31026
|
||||
on x=-44076..-28970,y=-69649..-38867,z=31937..54687
|
||||
off x=-6903..6265,y=-92551..-76965,z=10824..29131
|
||||
off x=-73096..-47990,y=-40737..-12561,z=-56032..-37870
|
||||
off x=-69834..-46771,y=-11406..9831,z=-70442..-38701
|
||||
off x=-63167..-28547,y=-2453..13753,z=-73159..-51770
|
||||
off x=-12546..-4517,y=-90466..-67177,z=-45521..-19870
|
||||
on x=-29818..-1746,y=50057..67629,z=41692..53982
|
||||
on x=-84294..-59113,y=33649..49960,z=-514..23937
|
||||
off x=-57940..-53375,y=17137..29536,z=-66645..-34791
|
||||
on x=-45417..-13403,y=-22323..12972,z=56661..78987
|
||||
on x=37008..53186,y=-52723..-32702,z=-81286..-61118
|
||||
off x=62401..92686,y=-32370..-8632,z=3648..32213
|
||||
on x=46130..54088,y=12139..21408,z=60375..72557
|
||||
on x=-78284..-60622,y=-60558..-34232,z=3228..21753
|
||||
off x=-26367..-17693,y=-44140..-38359,z=-76315..-54921
|
||||
on x=-50778..-25901,y=-62396..-47707,z=-46585..-24121
|
||||
on x=-31891..-7439,y=-38110..-6297,z=-83562..-54313
|
||||
on x=53088..73992,y=-40054..-10359,z=37676..54496
|
||||
off x=16508..40245,y=-62074..-36376,z=-71638..-56256
|
||||
off x=41517..56789,y=31056..37033,z=41339..66625
|
||||
off x=-70827..-68212,y=7248..41853,z=-32734..-16519
|
||||
off x=32333..52847,y=-89957..-62307,z=-5050..6149
|
||||
off x=-17149..-10468,y=-32928..-9851,z=56537..82605
|
||||
on x=-84541..-54098,y=-58633..-36289,z=-12748..2668
|
||||
on x=38782..73823,y=-47393..-38721,z=16744..50416
|
||||
off x=39068..59022,y=21209..55515,z=34421..52108
|
||||
on x=-71216..-46104,y=-73471..-55003,z=-37496..-2060
|
||||
off x=-42432..-23889,y=-86804..-68846,z=-3653..23244
|
||||
off x=-16056..17364,y=-72921..-54772,z=-40563..-21696
|
||||
off x=-25993..-10482,y=18139..45085,z=-86836..-55465
|
||||
off x=-6145..6154,y=15388..23210,z=-89142..-68482
|
||||
on x=46085..67991,y=-73185..-44337,z=-45070..-27405
|
||||
on x=65191..77310,y=644..12100,z=6335..26349
|
||||
on x=61530..80630,y=33572..40611,z=3139..25295
|
||||
off x=-22306..-1057,y=-64514..-54752,z=50646..59125
|
||||
off x=-31245..428,y=-69703..-42002,z=33460..67700
|
||||
off x=18783..26105,y=57879..76612,z=-46736..-17226
|
||||
on x=65144..85202,y=-34414..-9442,z=-15694..-3293
|
||||
on x=-30025..-19969,y=2384..18772,z=-85674..-56255
|
||||
on x=-21671..-1706,y=-88695..-66277,z=-32871..-31219
|
||||
off x=41938..56563,y=36056..55655,z=29417..39627
|
||||
off x=-35141..-13943,y=51556..73844,z=12868..28552
|
||||
off x=-62811..-35918,y=-44104..-21236,z=35127..62940
|
||||
on x=62916..82143,y=7866..27555,z=17805..50739
|
||||
on x=29498..66404,y=-38144..-7002,z=52432..62757
|
||||
off x=-40743..-17461,y=-3977..27203,z=-82649..-69934
|
||||
on x=61462..87066,y=-29424..1075,z=-53444..-28127
|
||||
off x=-20296..755,y=-68543..-34376,z=45810..71640
|
||||
off x=-69466..-36179,y=-62860..-52547,z=-31500..-5258
|
||||
off x=44866..53371,y=-24236..-6665,z=-73108..-53122
|
||||
off x=-79007..-53057,y=-17042..5274,z=22078..36248
|
||||
off x=-57167..-28268,y=-51111..-32915,z=-77704..-38825
|
||||
off x=-4958..9484,y=5801..13607,z=74030..98668
|
||||
on x=-35563..-13589,y=42209..54631,z=44769..75384
|
||||
off x=-60812..-37640,y=-63777..-55796,z=24372..34208
|
||||
off x=-46941..-16156,y=-36595..-17426,z=-79732..-64679
|
||||
on x=-59888..-28115,y=12521..32347,z=-78750..-58674
|
||||
on x=72376..82684,y=4253..30848,z=-40351..-9522
|
||||
off x=-32933..-1254,y=-75313..-57763,z=-49186..-39785
|
||||
on x=23434..55093,y=46836..66125,z=36750..49491
|
||||
on x=-46482..-28852,y=-3093..26488,z=52024..72731
|
||||
on x=43735..78088,y=-44597..-11422,z=-45272..-31611
|
||||
off x=9842..13060,y=-32334..-18544,z=-81402..-71916
|
||||
on x=4162..7921,y=-99019..-65156,z=-19030..4628
|
||||
on x=54190..69481,y=-597..28621,z=-39799..-25080
|
||||
off x=41810..71069,y=-60566..-49113,z=-28756..-6676
|
||||
off x=-79628..-67314,y=-10495..9141,z=-1753..22526
|
||||
on x=-80854..-54338,y=-47067..-35714,z=-41157..-4068
|
||||
off x=7961..36511,y=-68928..-39346,z=42154..66633
|
||||
on x=55071..86104,y=-26491..-12993,z=35080..46483
|
||||
on x=16937..38277,y=45614..76853,z=-68179..-32041
|
||||
on x=-59142..-45042,y=-44541..-15747,z=38408..54791
|
||||
on x=-8928..11676,y=-46464..-33539,z=-75322..-62649
|
||||
on x=-25001..-1799,y=60438..82665,z=-6409..20165
|
||||
on x=-73110..-45573,y=-56868..-33358,z=8495..25515
|
||||
on x=-1691..18521,y=60075..85944,z=-2617..10836
|
||||
off x=17339..45519,y=46033..72006,z=37649..43076
|
||||
off x=-79475..-70079,y=3154..12209,z=-24437..-12055
|
||||
off x=46696..52595,y=-51367..-22325,z=-49480..-29533
|
||||
off x=45715..64763,y=-22780..-16581,z=-78193..-55110
|
||||
off x=-16579..2489,y=-64160..-54806,z=41992..63536
|
||||
off x=-55417..-30493,y=-88205..-51837,z=-3486..19240
|
||||
off x=-77740..-75400,y=-16116..7915,z=-31057..-18206
|
368
src/day22.rs
Normal file
368
src/day22.rs
Normal file
@ -0,0 +1,368 @@
|
||||
use std::{convert::{TryFrom, TryInto}, num::ParseIntError, collections::HashSet};
|
||||
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Cuboid {
|
||||
x: (i32, i32),
|
||||
y: (i32, i32),
|
||||
z: (i32, i32)
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum StepAction {
|
||||
On,
|
||||
Off
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct RebootStep(StepAction, Cuboid);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ParseRangeError {
|
||||
Empty,
|
||||
BadLen,
|
||||
ParseInt(ParseIntError)
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ParseCuboidError {
|
||||
Empty,
|
||||
BadLen,
|
||||
ParseRange(ParseRangeError)
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ParseRebootStepError {
|
||||
Empty,
|
||||
BadLen,
|
||||
BadAction,
|
||||
ParseCuboid(ParseCuboidError)
|
||||
}
|
||||
|
||||
impl Cuboid {
|
||||
fn contains(&self, point: &(i32, i32, i32)) -> bool {
|
||||
self.x.0 <= point.0 && point.0 <= self.x.1 &&
|
||||
self.y.0 <= point.1 && point.1 <= self.y.1 &&
|
||||
self.z.0 <= point.2 && point.2 <= self.z.1
|
||||
}
|
||||
|
||||
fn clamp(&self, other: &Cuboid) -> Cuboid {
|
||||
Cuboid {
|
||||
x: (self.x.0.max(other.x.0), self.x.1.min(other.x.1)),
|
||||
y: (self.y.0.max(other.y.0), self.y.1.min(other.y.1)),
|
||||
z: (self.z.0.max(other.z.0), self.z.1.min(other.z.1)),
|
||||
}
|
||||
}
|
||||
|
||||
fn intersection(&self, other: &Cuboid) -> Option<Cuboid> {
|
||||
if self.z.0 > other.z.1 || other.z.0 > self.z.1 { return None; }
|
||||
if self.y.0 > other.y.1 || other.y.0 > self.y.1 { return None; }
|
||||
if self.x.0 > other.x.1 || other.x.0 > self.x.1 { return None; }
|
||||
Some(self.clamp(other))
|
||||
}
|
||||
|
||||
fn volume(&self) -> u64 {
|
||||
(self.x.1 - self.x.0 + 1) as u64 *
|
||||
(self.y.1 - self.y.0 + 1) as u64 *
|
||||
(self.z.1 - self.z.0 + 1) as u64
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ParseIntError> for ParseRangeError {
|
||||
fn from(e: ParseIntError) -> Self {
|
||||
ParseRangeError::ParseInt(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ParseRangeError> for ParseCuboidError {
|
||||
fn from(e: ParseRangeError) -> Self {
|
||||
ParseCuboidError::ParseRange(e)
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_range(value: &str) -> Result<(i32, i32), ParseRangeError> {
|
||||
if value.is_empty() {
|
||||
return Err(ParseRangeError::Empty);
|
||||
}
|
||||
let (start, end) = value[2..]
|
||||
.split_once("..")
|
||||
.ok_or(ParseRangeError::BadLen)?;
|
||||
Ok((start.parse()?, end.parse()?))
|
||||
}
|
||||
|
||||
impl TryFrom<&str> for Cuboid {
|
||||
type Error = ParseCuboidError;
|
||||
|
||||
fn try_from(value: &str) -> Result<Self, Self::Error> {
|
||||
if value.is_empty() {
|
||||
return Err(Self::Error::Empty);
|
||||
}
|
||||
let ranges: Vec<_> = value.split(',')
|
||||
.map(parse_range)
|
||||
.collect::<Result<_, _>>()?;
|
||||
if ranges.len() != 3 {
|
||||
return Err(Self::Error::BadLen);
|
||||
}
|
||||
Ok(Cuboid {
|
||||
x: ranges[0],
|
||||
y: ranges[1],
|
||||
z: ranges[2]
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ParseCuboidError> for ParseRebootStepError {
|
||||
fn from(e: ParseCuboidError) -> Self {
|
||||
ParseRebootStepError::ParseCuboid(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<&str> for RebootStep {
|
||||
type Error = ParseRebootStepError;
|
||||
|
||||
fn try_from(value: &str) -> Result<Self, Self::Error> {
|
||||
if value.is_empty() {
|
||||
return Err(Self::Error::Empty);
|
||||
}
|
||||
let (action_str, cuboid) = value.split_once(" ").ok_or(Self::Error::BadLen)?;
|
||||
|
||||
let action = match action_str {
|
||||
"on" => StepAction::On,
|
||||
"off" => StepAction::Off,
|
||||
_ => return Err(Self::Error::BadAction)
|
||||
};
|
||||
|
||||
Ok(RebootStep(action, cuboid.try_into()?))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_input(input: &str) -> Vec<RebootStep> {
|
||||
input.lines()
|
||||
.map(|l| l.try_into().unwrap())
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn count_cubes_in_cuboid(steps: &[RebootStep], region: &Cuboid) -> u32 {
|
||||
let mut cubes = HashSet::new();
|
||||
|
||||
for step in steps {
|
||||
let clamped = step.1.clamp(region);
|
||||
for x in clamped.x.0..=clamped.x.1 {
|
||||
for y in clamped.y.0..=clamped.y.1 {
|
||||
for z in clamped.z.0..=clamped.z.1 {
|
||||
let cube = (x, y, z);
|
||||
match step.0 {
|
||||
StepAction::On => cubes.insert(cube),
|
||||
StepAction::Off => cubes.remove(&cube)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cubes.len() as u32
|
||||
}
|
||||
|
||||
// From: http://twocentstudios.com/2016/08/16/calculating-the-area-of-multiple-intersecting-rectangles-with-swift
|
||||
/*
|
||||
fn total_volume(cuboids: &Vec<Cuboid>) -> u64 {
|
||||
let mut unique_x = HashSet::new();
|
||||
let mut unique_y = HashSet::new();
|
||||
let mut unique_z = HashSet::new();
|
||||
for cuboid in cuboids {
|
||||
unique_x.insert(cuboid.x.0);
|
||||
unique_x.insert(cuboid.x.1);
|
||||
unique_y.insert(cuboid.y.0);
|
||||
unique_y.insert(cuboid.y.1);
|
||||
unique_z.insert(cuboid.z.0);
|
||||
unique_z.insert(cuboid.z.1);
|
||||
}
|
||||
|
||||
let mut unique_x: Vec<_> = unique_x.iter().collect();
|
||||
let mut unique_y: Vec<_> = unique_y.iter().collect();
|
||||
let mut unique_z: Vec<_> = unique_z.iter().collect();
|
||||
|
||||
unique_x.sort();
|
||||
unique_y.sort();
|
||||
unique_z.sort();
|
||||
|
||||
let mut volume = 0;
|
||||
for (i, x) in unique_x.iter().enumerate().skip(1) {
|
||||
for (j, y) in unique_y.iter().enumerate().skip(1) {
|
||||
for (k, z) in unique_z.iter().enumerate().skip(1) {
|
||||
let cuboid = Cuboid {
|
||||
x: (*unique_x[i-1], **x),
|
||||
y: (*unique_y[j-1], **y),
|
||||
z: (*unique_z[k-1], **z)
|
||||
};
|
||||
for c in cuboids {
|
||||
if c.has_overlap(&cuboid) {
|
||||
volume += cuboid.volume();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// let point = (
|
||||
// (*unique_x[i-1] + **x)/2,
|
||||
// (*unique_y[j-1] + **y)/2,
|
||||
// (*unique_z[k-1] + **z)/2
|
||||
// );
|
||||
// for c in cuboids {
|
||||
// if c.contains(&point) {
|
||||
// let cuboid = Cuboid {
|
||||
// x: (*unique_x[i-1], **x),
|
||||
// y: (*unique_y[j-1], **y),
|
||||
// z: (*unique_z[k-1], **z)
|
||||
// };
|
||||
// volume += cuboid.volume();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
volume
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* From: https://github.com/Jellycious/aoc-2021/blob/main/src/days/day22.rs
|
||||
* Based on inclusion-exclusion principle. https://en.wikipedia.org/wiki/Inclusion%E2%80%93exclusion_principle
|
||||
*/
|
||||
fn count_cubes(steps: Vec<RebootStep>) -> u64 {
|
||||
let mut cuboids: Vec<(Cuboid, bool)> = Vec::new();
|
||||
|
||||
for step in steps {
|
||||
let mut extra_cuboids = Vec::new();
|
||||
for c in cuboids.iter() {
|
||||
if let Some(intersect) = step.1.intersection(&c.0) {
|
||||
extra_cuboids.push((intersect, !c.1));
|
||||
}
|
||||
}
|
||||
|
||||
if let StepAction::On = step.0 {
|
||||
cuboids.push((step.1, true));
|
||||
}
|
||||
cuboids.append(&mut extra_cuboids);
|
||||
}
|
||||
|
||||
let mut total_volume = 0;
|
||||
for (cuboid, additive) in cuboids {
|
||||
let sign: i64 = if additive { 1 } else { -1 };
|
||||
total_volume += sign * cuboid.volume() as i64;
|
||||
}
|
||||
total_volume as u64
|
||||
}
|
||||
|
||||
pub fn part1(steps: &[RebootStep]) -> u32 {
|
||||
let region = Cuboid{
|
||||
x: (-50, 50),
|
||||
y: (-50, 50),
|
||||
z: (-50, 50)
|
||||
};
|
||||
count_cubes_in_cuboid(steps, ®ion)
|
||||
}
|
||||
|
||||
pub fn part2(steps: Vec<RebootStep>) -> u64 {
|
||||
count_cubes(steps)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn part1_example() {
|
||||
let steps = parse_input("on x=-20..26,y=-36..17,z=-47..7
|
||||
on x=-20..33,y=-21..23,z=-26..28
|
||||
on x=-22..28,y=-29..23,z=-38..16
|
||||
on x=-46..7,y=-6..46,z=-50..-1
|
||||
on x=-49..1,y=-3..46,z=-24..28
|
||||
on x=2..47,y=-22..22,z=-23..27
|
||||
on x=-27..23,y=-28..26,z=-21..29
|
||||
on x=-39..5,y=-6..47,z=-3..44
|
||||
on x=-30..21,y=-8..43,z=-13..34
|
||||
on x=-22..26,y=-27..20,z=-29..19
|
||||
off x=-48..-32,y=26..41,z=-47..-37
|
||||
on x=-12..35,y=6..50,z=-50..-2
|
||||
off x=-48..-32,y=-32..-16,z=-15..-5
|
||||
on x=-18..26,y=-33..15,z=-7..46
|
||||
off x=-40..-22,y=-38..-28,z=23..41
|
||||
on x=-16..35,y=-41..10,z=-47..6
|
||||
off x=-32..-23,y=11..30,z=-14..3
|
||||
on x=-49..-5,y=-3..45,z=-29..18
|
||||
off x=18..30,y=-20..-8,z=-3..13
|
||||
on x=-41..9,y=-7..43,z=-33..15
|
||||
on x=-54112..-39298,y=-85059..-49293,z=-27449..7877
|
||||
on x=967..23432,y=45373..81175,z=27513..53682");
|
||||
let result = part1(&steps);
|
||||
assert_eq!(result, 590784);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn part2_example() {
|
||||
let steps = parse_input("on x=-5..47,y=-31..22,z=-19..33
|
||||
on x=-44..5,y=-27..21,z=-14..35
|
||||
on x=-49..-1,y=-11..42,z=-10..38
|
||||
on x=-20..34,y=-40..6,z=-44..1
|
||||
off x=26..39,y=40..50,z=-2..11
|
||||
on x=-41..5,y=-41..6,z=-36..8
|
||||
off x=-43..-33,y=-45..-28,z=7..25
|
||||
on x=-33..15,y=-32..19,z=-34..11
|
||||
off x=35..47,y=-46..-34,z=-11..5
|
||||
on x=-14..36,y=-6..44,z=-16..29
|
||||
on x=-57795..-6158,y=29564..72030,z=20435..90618
|
||||
on x=36731..105352,y=-21140..28532,z=16094..90401
|
||||
on x=30999..107136,y=-53464..15513,z=8553..71215
|
||||
on x=13528..83982,y=-99403..-27377,z=-24141..23996
|
||||
on x=-72682..-12347,y=18159..111354,z=7391..80950
|
||||
on x=-1060..80757,y=-65301..-20884,z=-103788..-16709
|
||||
on x=-83015..-9461,y=-72160..-8347,z=-81239..-26856
|
||||
on x=-52752..22273,y=-49450..9096,z=54442..119054
|
||||
on x=-29982..40483,y=-108474..-28371,z=-24328..38471
|
||||
on x=-4958..62750,y=40422..118853,z=-7672..65583
|
||||
on x=55694..108686,y=-43367..46958,z=-26781..48729
|
||||
on x=-98497..-18186,y=-63569..3412,z=1232..88485
|
||||
on x=-726..56291,y=-62629..13224,z=18033..85226
|
||||
on x=-110886..-34664,y=-81338..-8658,z=8914..63723
|
||||
on x=-55829..24974,y=-16897..54165,z=-121762..-28058
|
||||
on x=-65152..-11147,y=22489..91432,z=-58782..1780
|
||||
on x=-120100..-32970,y=-46592..27473,z=-11695..61039
|
||||
on x=-18631..37533,y=-124565..-50804,z=-35667..28308
|
||||
on x=-57817..18248,y=49321..117703,z=5745..55881
|
||||
on x=14781..98692,y=-1341..70827,z=15753..70151
|
||||
on x=-34419..55919,y=-19626..40991,z=39015..114138
|
||||
on x=-60785..11593,y=-56135..2999,z=-95368..-26915
|
||||
on x=-32178..58085,y=17647..101866,z=-91405..-8878
|
||||
on x=-53655..12091,y=50097..105568,z=-75335..-4862
|
||||
on x=-111166..-40997,y=-71714..2688,z=5609..50954
|
||||
on x=-16602..70118,y=-98693..-44401,z=5197..76897
|
||||
on x=16383..101554,y=4615..83635,z=-44907..18747
|
||||
off x=-95822..-15171,y=-19987..48940,z=10804..104439
|
||||
on x=-89813..-14614,y=16069..88491,z=-3297..45228
|
||||
on x=41075..99376,y=-20427..49978,z=-52012..13762
|
||||
on x=-21330..50085,y=-17944..62733,z=-112280..-30197
|
||||
on x=-16478..35915,y=36008..118594,z=-7885..47086
|
||||
off x=-98156..-27851,y=-49952..43171,z=-99005..-8456
|
||||
off x=2032..69770,y=-71013..4824,z=7471..94418
|
||||
on x=43670..120875,y=-42068..12382,z=-24787..38892
|
||||
off x=37514..111226,y=-45862..25743,z=-16714..54663
|
||||
off x=25699..97951,y=-30668..59918,z=-15349..69697
|
||||
off x=-44271..17935,y=-9516..60759,z=49131..112598
|
||||
on x=-61695..-5813,y=40978..94975,z=8655..80240
|
||||
off x=-101086..-9439,y=-7088..67543,z=33935..83858
|
||||
off x=18020..114017,y=-48931..32606,z=21474..89843
|
||||
off x=-77139..10506,y=-89994..-18797,z=-80..59318
|
||||
off x=8476..79288,y=-75520..11602,z=-96624..-24783
|
||||
on x=-47488..-1262,y=24338..100707,z=16292..72967
|
||||
off x=-84341..13987,y=2429..92914,z=-90671..-1318
|
||||
off x=-37810..49457,y=-71013..-7894,z=-105357..-13188
|
||||
off x=-27365..46395,y=31009..98017,z=15428..76570
|
||||
off x=-70369..-16548,y=22648..78696,z=-1892..86821
|
||||
on x=-53470..21291,y=-120233..-33476,z=-44150..38147
|
||||
off x=-93533..-4276,y=-16170..68771,z=-104985..-24507");
|
||||
let result = part2(steps);
|
||||
assert_eq!(result, 2758514936282235);
|
||||
}
|
||||
}
|
@ -19,6 +19,7 @@ mod day18;
|
||||
mod day19;
|
||||
mod day20;
|
||||
mod day21;
|
||||
mod day22;
|
||||
|
||||
use std::{env, process};
|
||||
use std::fs::File;
|
||||
@ -77,6 +78,8 @@ fn run(day: i32, part: i32, input_filename: &str) {
|
||||
"20.2" => println!("{}", day20::part2(&day20::parse_input(&contents))),
|
||||
"21.1" => println!("{}", day21::part1(&day21::parse_input(&contents))),
|
||||
"21.2" => println!("{}", day21::part2(&day21::parse_input(&contents))),
|
||||
"22.1" => println!("{}", day22::part1(&day22::parse_input(&contents))),
|
||||
"22.2" => println!("{}", day22::part2(day22::parse_input(&contents))),
|
||||
_ => println!("Day {} part {} not found", day, part)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user