heh
2016/10
bendn 11 months ago
parent 9cd3159 · commit fc83c59
-rw-r--r--Cargo.toml1
-rw-r--r--src/inp.txt232
-rw-r--r--src/main.rs72
-rw-r--r--src/util.rs1
4 files changed, 280 insertions, 26 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 872b22d..773f1ba 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,6 +8,7 @@ edition = "2024"
[dependencies]
atools = "0.1.5"
car = "0.1.1"
+collar = "1.0.1"
implicit-fn = "0.1.0"
# hinted = "0.0.1"
itertools = "0.12.0"
diff --git a/src/inp.txt b/src/inp.txt
index 1444fca..e54a491 100644
--- a/src/inp.txt
+++ b/src/inp.txt
@@ -1 +1,231 @@
-LGOFNEIZBERESE(15x10)WREHFFHTWBHRRRU(53x15)(8x13)ZSLUBGUV(2x10)BP(6x8)SQVMPH(7x13)VREWUWH(2x4)MK(4x12)LAMTLYVGMJBGV(3890x4)(476x3)(469x6)(2x11)JA(178x6)(21x4)(15x7)VLGRVVFKAFABGTK(138x4)(64x7)(15x1)CMTEMCSWIXJMGBT(1x3)I(1x6)W(2x10)ST(17x3)AJMUZMJJIVJZKYIQZ(26x9)(11x7)SKNTEGAWXJK(3x14)RBX(29x14)(2x5)CC(15x15)IHTOCPMHLXCMGSK(1x3)Y(268x12)(67x12)(25x12)(18x11)CMGYCGVFIJJHFXUXXC(29x5)(15x4)SXQNTSHXNZPFLUD(3x7)GGG(76x9)(19x15)QVRRXQTUICUEZCLFDXT(18x3)(4x5)FYZL(3x15)IJA(19x13)(12x10)JIBNDTKTFIGS(95x12)(12x8)UEOOOMBMVHNF(13x15)(2x8)WN(1x7)W(51x5)(7x7)VPYVWUM(6x4)WGKWJH(2x5)BJ(15x1)JBTWFTOYNLETYLN(4x12)EXQT(369x4)(17x5)LJDWKBGHSYUBLGYMJ(200x5)(193x2)(1x14)D(2x14)JW(170x14)(84x12)(3x6)MZF(7x8)YCKPFNG(5x6)UGSEH(34x3)VVFMFCRDNBUJRKGNFKKNFGIUCKUKYBPXFA(9x4)UVLPMRFSB(72x11)(8x3)KEETQJCD(19x14)FFZODYTJTFWJTJONYAU(9x13)HKDZCARQS(2x2)VI(6x8)FSYORJ(132x9)(64x1)(42x9)(35x12)DVEOTDSEZALAQUMPNDIJZSEKAIHRHBAOPMM(10x7)YAGGVJPQIO(45x7)(29x14)(3x13)OYD(3x14)YBV(5x12)VKNUN(4x1)LCYM(5x11)HLCNL(1829x8)(18x6)KEHUTEWBGUBSXCXQEO(731x7)(88x3)(81x12)(7x6)RPPVJWU(8x12)IMLOELYM(48x14)OOOREAITEWVOTQTXCPKFXZAVTSURFWCHBBFEYZQKMSZRCWDF(189x8)(43x14)(3x14)YUR(14x5)FEDTJREEKOTVBN(9x9)PDNXLZGSQ(132x3)(87x11)(28x14)UXMEKMYEPEHOJADISCUEEDQGCXOU(46x5)KSDPAWPICNVMAPOGBUOAOJLHNTFXRGOTCCASCRWHZEVBSJ(4x3)SQLU(6x6)NYNYJX(7x9)KZQEBLI(1x9)Z(51x6)(17x14)AESEANURBPRLIUGOK(1x14)G(13x15)YTJWLSNGFIVIJ(329x9)(56x13)(37x4)(20x14)UZPRLYROJFKXEMXQKVUR(4x11)ITWR(8x1)(2x10)DZ(44x9)(9x3)CMMWVJLTC(14x3)TEQDNBFIJRYBAF(5x6)OVNWE(177x4)(59x9)(1x3)E(2x8)MQ(27x8)XKFBOUUYQETOREFLDTWALKLBYOW(7x10)IREQNYE(8x8)OLPVYZBE(10x9)KXWLEZLMPG(76x10)(3x14)LMR(1x2)A(12x10)AXRBJWZOJTJN(14x9)TLTCQXTDTWHVDQ(15x12)WYGGJEUJLCGMXLT(19x2)UIYZRZLQZADHKOKIGFR(2x2)LD(42x3)(17x9)(10x14)UWDPGTKTIF(13x7)QCWIXFBSUHAKI(1058x11)(15x3)ANRMPBDNNPIFHKH(441x12)(257x10)(55x1)(15x11)YWQLJELYWEPLWFS(11x6)RISQOQPFZBR(3x11)CCU(1x12)D(49x6)(3x12)MHH(26x9)NYRDYJXGUNQMAEKDHXXJRHQRTE(2x10)XU(134x9)(4x1)FFSP(17x5)ATYRUCYHXVEBECITL(32x10)GOFQQNWJOHEDXWDHNHHIPFWNVVNSQRHQ(17x4)WRAMPKCANFVZSXZJV(33x14)PCWLYCXMEYPDIPQTOBLTXJTSSGQBTDZTL(17x8)UHDOCXHMLKLCQROCY(3x9)EBR(2x15)JD(130x8)(93x2)(13x3)WEKBKGEMKGYZO(31x10)NJFKDUANTMNKLHRIMOJQSCHCAZBPRSA(2x14)YE(22x7)BLHGOKITLFPZHOUEFOSXOJ(25x2)ZGWXUEGVFVNVKYJMVTYXYXNUN(5x15)HYWYV(248x5)(167x11)(10x3)DIEPDEHMWO(7x12)KPVAOCU(4x12)SYSM(71x8)(6x14)LCHAHJ(10x1)UOROHLBRPT(8x8)KQVXLLDE(23x13)ZKIDGFRFHVMPJGIGRMZULJB(44x11)(22x8)OCELLJMRMWKTYTARNFBZXP(4x8)CDCR(1x15)M(26x14)(19x10)UOTNOCGWSJJDCKQTCKK(33x14)(26x14)(1x15)U(6x9)PQBVGE(2x14)SK(315x2)(101x15)(11x4)XEIOGBPUAVP(7x7)SNFQPAN(66x3)(7x1)IBOLPRC(5x12)IILSU(22x3)DWPQHNDXFSOQOZMCJLGFAT(9x12)CCSGHKJUB(137x13)(44x13)(12x11)RSLZQKBGMWXD(8x3)XCPONCTK(6x12)XFIVZD(59x15)(10x2)SFEWCBYJLP(12x6)TLXNHCOGXSHT(11x2)HGNTLLOAQXP(3x4)UGK(14x2)WLZNEGJGBFZPGX(11x7)ZLZHPGIRASX(37x15)(31x3)(25x8)OLZKEQMBKCGLYRRVDVCEQKCKR(1186x6)(7x8)QLRZYMC(1165x13)(518x15)(93x2)(8x9)AFUJHCYW(22x9)(15x11)FBAMVGJBIQYBBXG(8x10)SNMOLOPJ(31x11)(8x15)GQHGNILV(6x2)RBTJZV(1x9)M(122x15)(29x12)(14x3)JLJWMHHKYUBKOR(3x10)YZW(67x11)(15x9)FAKETSOJABEZXDR(28x1)XKLNGAMOVPLHHVEBPKBIOHYGCCEC(6x12)KLQILI(6x13)YTVKEP(7x2)(1x14)N(146x14)(83x12)(9x12)GDDTHPDOE(11x7)JRNGNPXRUHS(4x5)MJXD(3x9)LQP(27x13)IGYEXRHYJOEVMGCOQWFLXLYLLDS(50x5)(17x14)YIZNUVEEANOMWRPUJ(3x11)SFD(1x15)H(5x4)QQYMJ(116x7)(6x2)(1x3)F(4x5)APFG(49x1)(20x12)LZOYUEYAYGPKUGVUXILH(1x7)H(2x15)PF(2x14)YG(34x12)(5x15)MBDAB(4x13)HWRR(8x3)DHHLKMQW(20x4)BENSZCITJXYAWBNEUCFD(210x14)(22x12)CMDNMFGXYDPQNBXJDJRCGO(71x14)(8x11)DYKDBNSY(51x3)(12x2)NUDPTBPZBXEA(9x6)EPDZXMHBF(6x14)EYKHHJ(2x4)DB(10x13)RBSGMQTVZO(79x12)(15x11)FPGHXWCOFCPVRTW(50x13)(8x10)MZZRZNYK(10x6)OAYWSWLXOK(7x7)WCEBDJK(3x8)SVU(260x4)(169x12)(11x7)DEIONQVAKBA(48x15)PATXTTKRRFCAARYBILLOLEYKAEQJSVINEWYCZVGYRYRPOACF(3x5)PEQ(37x1)(2x10)XD(22x15)EVGMYADJGFTIVPBIONGEEJ(40x7)(16x10)KAQBMNTOUBFGNALW(11x5)XZBCSAILSRN(30x5)(3x8)SQN(15x11)CIORLHCKBDFRYXI(41x5)NPRBDBXGEBVIJJCBEFVKHHTBWHKOZJDRPCDYXXVZH(120x11)(92x14)(86x2)(14x5)NHNBNCRUAKEHOU(12x9)BRZXPINASPRY(25x6)HACEPHQVKKDWVQMENMDIVROFU(10x14)OMOFODPEOA(14x12)UPSRXDLUJQGIJW(6957x11)(2773x7)(668x13)(7x2)BPQHZZC(9x13)CDKSCVKJD(332x4)(3x12)UOW(201x6)(10x6)WSVTZCMRUR(83x2)(9x4)FLKXMYGAO(8x11)RTHIMASK(8x2)GEULXLDA(4x7)AUFM(27x2)CRKGUWYOIRHNXMGRIDZMHKYCMOG(78x12)(23x10)NSHGSSNLVSNBRRIRMALJVJY(21x1)HLBBYHLRWJVDUBNSAIYWH(3x7)UQF(7x14)LHUMKCO(6x3)(1x7)L(60x14)(6x12)RTGJPT(42x4)(2x10)SH(27x13)XKTQQGDKVOUHRBTLXXOFIUZYKAJ(41x13)(12x12)(6x13)BXVYVD(15x14)VAWZONWCLAZGACI(42x14)(5x2)XCEEQ(13x10)(7x11)FGANWCY(7x6)QNQIVBX(246x2)(1x10)R(2x11)MU(200x2)(73x1)(9x11)UIXCPBFLA(3x4)XQX(10x11)YBKGSWRBTR(19x10)HTFIGGWYMRCLOWBLPJP(2x8)WK(88x1)(20x4)CUJCASDMNIOHRAEOWJNH(2x13)LS(7x8)IAVEHOA(18x11)NHBDZZVSMWSLCREBZS(11x5)RBQSFIGZNXC(20x14)(14x6)ZMQGCYHRUTBESA(17x14)(1x15)Y(4x14)YVSN(12x11)COEVGMUJHPYX(1180x12)(205x9)(23x15)RXGJOKLWHIKNHHDPFJWMGDY(168x1)(36x7)(8x7)UTRSZKGD(17x3)HFMJKZVBYIYCXWIJL(51x11)(1x9)Y(5x13)NGDPT(13x9)TVVNBVTINOEHP(1x15)C(3x6)AFW(53x4)(1x3)K(9x3)HXZXQIYVS(8x10)JMCUTOGU(3x4)MRC(6x3)MMKZVW(3x15)YFR(286x6)(97x1)(13x8)GLAHXBVMQKDPY(48x8)(14x15)UISXBFUNVUTDBU(9x4)PIDJSHRRR(8x8)LWHPTYBI(18x4)(11x10)HRDBXIVTSOY(91x3)(10x12)(4x15)NCVY(41x3)(7x9)HXIEUXP(3x4)WKY(1x2)O(9x14)HQUXEISFC(21x7)XQWTHKZVAMKGHISXJFIBQ(80x3)(8x5)(2x15)SS(47x14)(19x13)IOALBJTWLBNDLYXDKWI(5x6)WSNZD(6x2)BBNZXK(1x8)V(2x9)MQ(659x5)(87x14)(45x13)(9x5)HDTIHQXBB(9x11)OWNEYFP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(2x1)YX(123x2)(26x4)(11x3)RCAGDSSJIDO(4x5)WRPW(3x13)VVT(39x7)(9x10)LOEHIFUHC(1x10)P(10x10)MEPFDFIBIB(31x5)EOZCWOYPJQKPAFDRQYBDWIQRLAYRZTB(251x9)(33x4)(27x2)(21x1)VIMECWPZNBZXHPBGILCSZ(1x6)M(16x6)HRYDSUOHVOAZTZZV(125x13)(9x14)THXAIDLDZ(84x8)(10x8)YVJRCPWPSD(40x3)DDCJQUVNRYYVLGZRAIVRHQOATRNBTZNGAFJGLMTC(15x14)JONITCQZKGTEZBK(14x1)BNJAIASKMVYGAZ(45x9)(24x11)(4x14)PONO(1x14)L(2x4)HH(9x4)(4x4)XFKS(2756x11)(1175x4)(215x10)(191x5)(59x3)(15x11)EQTAUUTIXNGDVQF(13x10)LIDANKWYTSKFG(6x6)LQDUNS(1x7)C(8x8)DQVFLUSA(36x11)HSWOJGEEVUNRLBSOYXCIWNVCUTTYUBRFAMBH(32x2)(11x15)QUPODDOZROY(1x1)I(3x9)QAC(26x4)(9x13)HBWBMODAJ(5x14)QAEOH(4x12)GLMJ(2x4)GE(288x13)(2x9)UQ(52x7)(38x3)(4x12)SLSK(6x8)IALRJB(4x4)KMKU(3x7)DDJ(2x12)XF(159x3)(44x8)(14x12)OTKKTORLGQEDQS(9x12)QENIVCCIC(2x10)ZR(44x5)(5x11)ZJVET(2x6)ZJ(13x3)ULNYBVCKJYQMR(1x13)W(52x14)(5x14)KQXMR(7x14)IAAETMD(7x1)XMLCYLI(10x5)OOHZZRPWMJ(26x4)CUQPMHEGQSIRDOUYWEZLJFYWFH(19x7)(13x4)TKHMAFYATABBC(337x5)(57x10)(13x2)QHJWUOEGNMUAM(21x14)(14x14)DPIWLJTLVOCFDU(5x1)CGBWE(132x11)(7x6)MXDTWDT(6x5)UBDAJF(76x7)(1x1)S(18x9)BHZAFJWBAPYQLJNSAY(2x11)XS(7x10)SNOTOHU(18x12)QDSDVNTKOCTAGFKBXU(21x9)KZZVTAGUPLV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HUSDMMSCGSHFBCTNSBYQOTGQWKFE(4x13)JPFM(1x12)S(18x9)(6x9)STRMDN(2x6)QJ(1x6)A(85x2)(35x6)(1x6)M(9x11)HDKULQVIW(8x10)YYBMAZMI(25x1)BUHKLAPTSOYBPSAAOGRODAODX(8x5)GBLYBHAP(28x10)(4x10)RFQR(5x8)OLDCC(3x9)EXM(17x6)(11x3)DTSXIDNTCLZ(261x9)(68x1)(5x10)MRVNO(11x5)GXKDSRBIVLS(4x12)SKRZ(23x15)XFZZFEFZYWYMZDEGGXCASXJ(106x4)(19x5)NSAHKHHPOZKBGWWYFZK(51x10)KDQIFXTDUWASPPUUOSOCVZZJZDBMRLHBEJLJNECJXAXRNOCKIDW(17x3)ZFPZSHJVVDBXUAXZO(67x11)(1x7)X(18x12)YPRRQFMGVOOSSGYMCG(14x2)VQFLFHQXSFFTIZ(4x7)BVDG(2x7)PZ(236x14)(15x2)JMEWTVZEMNSCQKK(12x10)MCIJMNVHKAUS(101x10)(13x9)COPCVWUZACUEC(2x2)WE(2x13)JY(54x5)CVYPMTTHUUWPTIJESKIMBKOZBEBTBCBXSKDGGHQUFRUMPMPTUNMMBE(2x7)OS(62x7)(5x11)TMXTO(8x8)YAXVDDKY(17x8)XYFVEVJJRJNXETBEC(4x2)ABWU(1x2)I(13x8)PIYPJGCJFOQCX(7x13)(2x2)EY(16x14)(10x5)DFIMDLYUXJ(218x12)(2x1)CX(73x15)(2x2)RU(15x8)ECPPNWBEZJYBNHV(9x1)OKZJTVCFC(14x12)IGNLOLAUOMFKFQ(4x15)CQQM(83x12)(9x11)LDWSCQELC(9x2)LEHXGSNJM(10x10)RRUQNWJDHH(6x3)GYHOEF(20x3)YGMAVMVWEWKYMJCYJRTJ(21x11)PIVCAXCKZMIUXAEIPFVQF(8x1)EKZBFTRW \ No newline at end of file
+value 61 goes to bot 209
+bot 200 gives low to bot 40 and high to bot 141
+bot 197 gives low to bot 202 and high to bot 65
+bot 19 gives low to bot 170 and high to bot 120
+bot 25 gives low to bot 8 and high to bot 193
+bot 151 gives low to bot 100 and high to bot 188
+bot 187 gives low to bot 89 and high to bot 142
+bot 40 gives low to bot 85 and high to bot 172
+bot 55 gives low to bot 94 and high to bot 2
+bot 149 gives low to bot 57 and high to bot 75
+value 37 goes to bot 97
+bot 140 gives low to bot 29 and high to bot 71
+bot 77 gives low to bot 7 and high to bot 86
+bot 189 gives low to bot 62 and high to bot 168
+value 67 goes to bot 4
+bot 194 gives low to output 9 and high to bot 74
+bot 46 gives low to bot 96 and high to bot 187
+bot 93 gives low to bot 82 and high to bot 108
+bot 18 gives low to output 5 and high to bot 78
+bot 37 gives low to bot 1 and high to bot 101
+bot 28 gives low to bot 65 and high to bot 87
+bot 146 gives low to bot 117 and high to bot 6
+bot 6 gives low to bot 22 and high to bot 134
+bot 207 gives low to bot 20 and high to bot 135
+bot 29 gives low to bot 126 and high to bot 157
+bot 126 gives low to bot 146 and high to bot 131
+bot 23 gives low to bot 138 and high to bot 173
+bot 92 gives low to bot 60 and high to bot 171
+bot 177 gives low to bot 203 and high to bot 28
+value 47 goes to bot 167
+bot 190 gives low to bot 68 and high to bot 133
+bot 56 gives low to bot 191 and high to bot 146
+bot 75 gives low to bot 5 and high to bot 92
+value 11 goes to bot 136
+bot 4 gives low to bot 136 and high to bot 55
+bot 143 gives low to bot 109 and high to bot 125
+bot 14 gives low to bot 90 and high to bot 184
+bot 100 gives low to bot 156 and high to bot 188
+bot 65 gives low to bot 49 and high to bot 87
+bot 180 gives low to bot 95 and high to bot 56
+bot 155 gives low to bot 196 and high to bot 41
+bot 154 gives low to bot 153 and high to bot 25
+value 17 goes to bot 48
+bot 10 gives low to bot 124 and high to bot 177
+bot 188 gives low to bot 137 and high to bot 106
+bot 138 gives low to bot 182 and high to bot 93
+bot 119 gives low to bot 118 and high to bot 206
+bot 208 gives low to bot 70 and high to bot 45
+bot 114 gives low to bot 204 and high to bot 19
+bot 141 gives low to bot 172 and high to bot 1
+value 53 goes to bot 153
+bot 71 gives low to bot 157 and high to bot 163
+bot 48 gives low to bot 200 and high to bot 123
+bot 96 gives low to bot 86 and high to bot 187
+bot 169 gives low to output 19 and high to output 11
+value 41 goes to bot 99
+bot 134 gives low to bot 13 and high to bot 112
+bot 113 gives low to bot 128 and high to bot 11
+bot 95 gives low to bot 186 and high to bot 191
+bot 105 gives low to bot 125 and high to bot 90
+bot 204 gives low to bot 122 and high to bot 19
+bot 193 gives low to bot 38 and high to bot 116
+bot 67 gives low to output 6 and high to bot 18
+value 71 goes to bot 52
+bot 159 gives low to output 8 and high to bot 175
+bot 121 gives low to bot 42 and high to bot 109
+bot 43 gives low to output 12 and high to bot 194
+bot 76 gives low to bot 147 and high to bot 190
+bot 79 gives low to bot 108 and high to bot 147
+bot 163 gives low to bot 91 and high to bot 24
+bot 44 gives low to bot 75 and high to bot 182
+bot 205 gives low to bot 159 and high to bot 0
+value 23 goes to bot 70
+bot 103 gives low to bot 69 and high to bot 127
+bot 106 gives low to bot 199 and high to bot 64
+bot 202 gives low to bot 11 and high to bot 49
+bot 84 gives low to bot 25 and high to bot 185
+bot 116 gives low to bot 179 and high to bot 176
+bot 160 gives low to bot 18 and high to bot 50
+value 2 goes to bot 130
+bot 128 gives low to bot 24 and high to bot 51
+value 5 goes to bot 200
+bot 78 gives low to output 18 and high to bot 169
+bot 109 gives low to bot 81 and high to bot 12
+bot 83 gives low to bot 71 and high to bot 162
+bot 101 gives low to bot 119 and high to bot 32
+bot 53 gives low to bot 31 and high to bot 181
+bot 133 gives low to bot 139 and high to bot 114
+bot 122 gives low to bot 41 and high to bot 170
+bot 33 gives low to bot 161 and high to bot 151
+bot 206 gives low to bot 53 and high to bot 178
+bot 153 gives low to bot 167 and high to bot 8
+bot 195 gives low to bot 0 and high to bot 69
+bot 172 gives low to bot 84 and high to bot 66
+bot 142 gives low to bot 190 and high to bot 133
+bot 107 gives low to bot 162 and high to bot 113
+bot 3 gives low to bot 63 and high to bot 189
+bot 167 gives low to bot 4 and high to bot 16
+value 13 goes to bot 150
+bot 131 gives low to bot 6 and high to bot 36
+bot 145 gives low to bot 72 and high to bot 166
+bot 170 gives low to bot 98 and high to bot 120
+bot 13 gives low to bot 74 and high to bot 149
+bot 186 gives low to output 1 and high to bot 104
+bot 90 gives low to bot 140 and high to bot 83
+bot 30 gives low to output 14 and high to bot 67
+bot 66 gives low to bot 185 and high to bot 118
+bot 165 gives low to output 0 and high to bot 159
+bot 88 gives low to bot 56 and high to bot 126
+bot 21 gives low to bot 79 and high to bot 76
+bot 127 gives low to bot 15 and high to bot 204
+bot 49 gives low to bot 145 and high to bot 58
+bot 86 gives low to bot 21 and high to bot 89
+bot 164 gives low to bot 26 and high to bot 180
+bot 203 gives low to bot 197 and high to bot 28
+value 43 goes to bot 40
+bot 35 gives low to bot 148 and high to bot 111
+bot 47 gives low to bot 207 and high to bot 161
+bot 50 gives low to bot 78 and high to bot 169
+bot 185 gives low to bot 193 and high to bot 102
+bot 32 gives low to bot 206 and high to bot 199
+bot 175 gives low to output 3 and high to bot 158
+bot 157 gives low to bot 131 and high to bot 91
+bot 98 gives low to bot 67 and high to bot 160
+bot 52 gives low to bot 150 and high to bot 207
+bot 22 gives low to bot 194 and high to bot 13
+bot 198 gives low to bot 44 and high to bot 138
+bot 64 gives low to bot 35 and high to bot 111
+bot 129 gives low to bot 183 and high to bot 132
+bot 120 gives low to bot 160 and high to bot 50
+bot 87 gives low to bot 58 and high to bot 46
+value 31 goes to bot 85
+value 59 goes to bot 39
+bot 2 gives low to bot 143 and high to bot 105
+bot 8 gives low to bot 16 and high to bot 38
+bot 60 gives low to output 10 and high to bot 165
+bot 15 gives low to bot 155 and high to bot 122
+bot 70 gives low to bot 174 and high to bot 45
+bot 73 gives low to bot 105 and high to bot 14
+bot 42 gives low to bot 164 and high to bot 81
+bot 20 gives low to bot 123 and high to bot 80
+bot 108 gives low to bot 144 and high to bot 61
+bot 1 gives low to bot 66 and high to bot 119
+bot 132 gives low to bot 198 and high to bot 23
+bot 17 gives low to bot 2 and high to bot 73
+bot 191 gives low to bot 104 and high to bot 117
+bot 62 gives low to bot 107 and high to bot 115
+bot 168 gives low to bot 115 and high to bot 197
+bot 161 gives low to bot 135 and high to bot 151
+bot 117 gives low to bot 43 and high to bot 22
+value 3 goes to bot 208
+bot 81 gives low to bot 180 and high to bot 88
+bot 184 gives low to bot 83 and high to bot 107
+bot 16 gives low to bot 55 and high to bot 17
+bot 152 gives low to output 20 and high to bot 186
+bot 102 gives low to bot 116 and high to bot 31
+bot 61 gives low to bot 195 and high to bot 103
+bot 38 gives low to bot 17 and high to bot 179
+bot 178 gives low to bot 181 and high to bot 35
+bot 34 gives low to bot 39 and high to bot 42
+bot 162 gives low to bot 163 and high to bot 128
+bot 63 gives low to bot 184 and high to bot 62
+bot 148 gives low to bot 59 and high to bot 10
+value 19 goes to bot 208
+bot 124 gives low to bot 168 and high to bot 203
+bot 179 gives low to bot 73 and high to bot 110
+bot 123 gives low to bot 141 and high to bot 37
+bot 45 gives low to bot 27 and high to bot 33
+bot 7 gives low to bot 173 and high to bot 21
+value 29 goes to bot 34
+bot 174 gives low to bot 99 and high to bot 27
+bot 68 gives low to bot 103 and high to bot 139
+bot 173 gives low to bot 93 and high to bot 79
+bot 54 gives low to bot 3 and high to bot 59
+bot 11 gives low to bot 51 and high to bot 145
+bot 176 gives low to bot 110 and high to bot 3
+bot 9 gives low to bot 23 and high to bot 7
+bot 182 gives low to bot 92 and high to bot 82
+bot 125 gives low to bot 12 and high to bot 140
+bot 94 gives low to bot 121 and high to bot 143
+bot 201 gives low to bot 158 and high to bot 155
+bot 31 gives low to bot 176 and high to bot 54
+bot 74 gives low to output 16 and high to bot 57
+bot 111 gives low to bot 10 and high to bot 177
+bot 196 gives low to output 15 and high to bot 30
+bot 150 gives low to bot 48 and high to bot 20
+bot 112 gives low to bot 149 and high to bot 44
+bot 118 gives low to bot 102 and high to bot 53
+bot 136 gives low to bot 209 and high to bot 94
+bot 158 gives low to output 17 and high to bot 196
+bot 39 gives low to bot 130 and high to bot 164
+bot 144 gives low to bot 205 and high to bot 195
+bot 80 gives low to bot 37 and high to bot 156
+bot 91 gives low to bot 36 and high to bot 129
+bot 135 gives low to bot 80 and high to bot 100
+bot 57 gives low to output 4 and high to bot 5
+bot 99 gives low to bot 52 and high to bot 47
+bot 58 gives low to bot 166 and high to bot 46
+bot 130 gives low to bot 97 and high to bot 26
+bot 139 gives low to bot 127 and high to bot 114
+bot 89 gives low to bot 76 and high to bot 142
+bot 156 gives low to bot 101 and high to bot 137
+bot 104 gives low to output 2 and high to bot 43
+bot 26 gives low to bot 152 and high to bot 95
+bot 137 gives low to bot 32 and high to bot 106
+bot 171 gives low to bot 165 and high to bot 205
+bot 5 gives low to output 7 and high to bot 60
+bot 36 gives low to bot 134 and high to bot 183
+bot 85 gives low to bot 154 and high to bot 84
+value 73 goes to bot 154
+bot 82 gives low to bot 171 and high to bot 144
+bot 192 gives low to bot 132 and high to bot 9
+bot 209 gives low to bot 34 and high to bot 121
+bot 110 gives low to bot 14 and high to bot 63
+bot 51 gives low to bot 192 and high to bot 72
+bot 41 gives low to bot 30 and high to bot 98
+bot 115 gives low to bot 113 and high to bot 202
+bot 0 gives low to bot 175 and high to bot 201
+value 7 goes to bot 174
+bot 24 gives low to bot 129 and high to bot 192
+bot 12 gives low to bot 88 and high to bot 29
+bot 147 gives low to bot 61 and high to bot 68
+bot 199 gives low to bot 178 and high to bot 64
+bot 59 gives low to bot 189 and high to bot 124
+bot 181 gives low to bot 54 and high to bot 148
+bot 97 gives low to output 13 and high to bot 152
+bot 166 gives low to bot 77 and high to bot 96
+bot 69 gives low to bot 201 and high to bot 15
+bot 183 gives low to bot 112 and high to bot 198
+bot 27 gives low to bot 47 and high to bot 33
+bot 72 gives low to bot 9 and high to bot 77
diff --git a/src/main.rs b/src/main.rs
index 0886020..885da20 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -12,6 +12,8 @@
redundant_semicolons
)]
#![feature(
+ iterator_try_reduce,
+ cmp_minmax,
custom_inner_attributes,
extend_one,
slice_as_array,
@@ -43,44 +45,64 @@ extern crate test;
pub mod util;
use atools::prelude::*;
+use collar::CollectArray;
use lower::apply;
use memchr::memmem;
use regex::bytes::Regex;
-use std::{cmp::Reverse, simd::prelude::*};
+use std::{
+ cmp::{Reverse, minmax},
+ mem::take,
+ simd::prelude::*,
+};
pub use util::prelude::*;
#[allow(warnings)]
type u32x3 = Simd<u32, 3>;
+#[unsafe(no_mangle)]
#[implicit_fn::implicit_fn]
-fn expand(x: &[u8]) -> usize {
- let mut o = 0;
- let mut t = vec![];
- let mut i = 0;
- while i != x.len() {
- let c = x[i];
- i += 1;
- match c {
- b'(' => t.push(c),
- b')' => {
- let (range, amount) = t[1..].μ('x').mb(_.λ::<usize>());
- let n = expand(&x[i..i + range]);
- o += n * amount;
- i += range;
- t.clear();
+pub unsafe fn p1(x: &'static str) -> impl Display {
+ let mut bots = [const { vec![] }; 500];
+ let mut outputs = [!0; 100];
+ x.行().filter(|x| x.starts_with(b"value")).for_each(|x| {
+ let [_, v, _, _, _, i] = x.μₙ(b' ').collect_array();
+ let [v, i] = [v, i].map(_.λ::<usize>());
+ bots[i].push(v);
+ });
+ for x in x.行().filter(_.starts_with(b"bot")).cycle() {
+ let [b"bot", i, _, _, b"to", lo, lo_i, _, _, b"to", hi, hi_i] = x.μₙ(b' ').collect_array()
+ else {
+ unreachable!()
+ };
+ let [bot_i, lo_i, hi_i] = [i, lo_i, hi_i].map(_.λ::<usize>());
+ if let &[a, b] = &*bots[bot_i] {
+ let [lo_x, hi_x] = minmax(a, b);
+ match lo {
+ b"bot" => bots[lo_i].push(lo_x),
+ b"output" => outputs[lo_i] = lo_x,
+ _ => unreachable!(),
+ }
+ match hi {
+ b"bot" => bots[hi_i].push(hi_x),
+ b"output" => outputs[hi_i] = hi_x,
+ _ => unreachable!(),
}
- c if !t.is_empty() => t.push(c),
- _ => o += 1,
+ if lo_x == 17 && hi_x == 61 {
+ println!("{bot_i}");
+ // return bot_i;
+ }
+ bots[bot_i].clear();
+ }
+ if let Ok(x) = outputs[..=2]
+ .iter()
+ .filter(**_ != !0)
+ .collect_array_checked::<3>()
+ {
+ return x.map(*_).product();
}
}
- o
-}
-#[unsafe(no_mangle)]
-#[implicit_fn::implicit_fn]
-pub unsafe fn p1(x: &'static str) -> impl Display {
- let x = x.as_bytes();
- expand(x)
+ 0
}
fn main() {
diff --git a/src/util.rs b/src/util.rs
index e56aec4..b966bba 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -1511,6 +1511,7 @@ macro_rules! bits {
}
pub(crate) use bits;
+#[derive(Clone, Copy)]
pub struct Lines<'a> {
pub bytes: &'a [u8],
}