From 0a76882a48e55749620f1e5197e8758f8bcd4326 Mon Sep 17 00:00:00 2001 From: Florian Cassayre Date: Thu, 19 Dec 2024 08:31:39 +0100 Subject: [PATCH] Solved day 19 --- README.md | 2 +- input/19.txt | 402 ++++++++++++++++++ output/19-1.txt | 1 + output/19-2.txt | 1 + .../scala/adventofcode/solutions/Day19.scala | 29 ++ 5 files changed, 434 insertions(+), 1 deletion(-) create mode 100644 input/19.txt create mode 100644 output/19-1.txt create mode 100644 output/19-2.txt create mode 100644 src/main/scala/adventofcode/solutions/Day19.scala diff --git a/README.md b/README.md index daa10f3..3d734d4 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ _My solutions to the 2024 edition of [Advent of Code](https://adventofcode.com/2 | **[16](https://adventofcode.com/2024/day/16)** | [solution](src/main/scala/adventofcode/solutions/Day16.scala) | | **[17](https://adventofcode.com/2024/day/17)** | [solution](src/main/scala/adventofcode/solutions/Day17.scala) | | **[18](https://adventofcode.com/2024/day/18)** | [solution](src/main/scala/adventofcode/solutions/Day18.scala) | -| **[19](https://adventofcode.com/2024/day/19)** | [](src/main/scala/adventofcode/solutions/Day19.scala) | +| **[19](https://adventofcode.com/2024/day/19)** | [solution](src/main/scala/adventofcode/solutions/Day19.scala) | | **[20](https://adventofcode.com/2024/day/20)** | [](src/main/scala/adventofcode/solutions/Day20.scala) | | **[21](https://adventofcode.com/2024/day/21)** | [](src/main/scala/adventofcode/solutions/Day21.scala) | | **[22](https://adventofcode.com/2024/day/22)** | [](src/main/scala/adventofcode/solutions/Day22.scala) | diff --git a/input/19.txt b/input/19.txt new file mode 100644 index 0000000..94f2b1e --- /dev/null +++ b/input/19.txt @@ -0,0 +1,402 @@ +rrgbgg, gbgbgr, rrb, wrgggbb, rr, bgb, wbb, ruugr, gwugg, ruu, gubw, gru, bgg, uwu, bggwbrgw, wwugbr, ur, urb, bbb, rrbrbw, uww, wggwwu, wwrb, gbg, wuruu, wbgbwbr, ggu, grgwru, g, uugbuu, rwrrwb, uurwub, grgr, wubb, buwu, guu, bbw, rgwgbg, grr, uuuwr, ggubrrg, uuub, gugu, bur, bguub, rgr, bwu, bwbuw, wwwwbw, uurbbgb, rwb, uuw, ggurug, wrr, gww, rgbgu, wgr, rw, uguu, brb, ugrr, brwurgu, rugg, gbuwr, gb, uggbrbr, urwrbgb, rbgwbwb, gg, rur, uuu, wr, grur, uwugb, gbrugru, buug, bbrw, uurugru, u, bb, ubggb, brrb, rrg, bgur, gubub, gwwu, rugurug, ggbgbgbb, ggbwgr, gurw, gbgww, ugbg, gugb, grg, rggwg, buwb, wbu, guwu, rggbgugw, ggb, ruub, rugw, ugb, wrw, www, gwwbr, bru, bgurrbru, rrug, wubgug, brguw, wbugr, ggur, rgwuurrw, wurrg, rrgu, wwrwrb, brg, wwg, ugugu, ugr, rbgr, rg, uggg, rgrg, wwb, rrgrrwg, bgwb, brgbwgu, rurg, brw, brww, brggu, rgwwbbgg, uwgb, rwgggwwb, wrgrbw, bwrgw, wbbw, rbub, gbguuuub, bwrwg, uurruu, rugu, urrwguw, bwru, bu, wuub, ugggr, uuug, gu, uugggb, wbbb, rrr, b, rgwgr, gbr, gwrwwrw, ugu, ggw, wgub, wuw, uubr, ggrgbg, uwbbu, ubwurb, rbb, uur, uwrruug, wrggur, bwrr, wugb, wuwr, wwgb, wgubgg, wg, rgwbgwbw, rggugug, uub, uggug, wgu, brgrrub, rwwrgbr, gbgrgr, grgubbu, ugbbr, urw, ubuubb, burgw, ubu, gwgub, wwwubrgu, wwwww, bgr, bgu, gwwruuw, wgrgw, uwuu, wrb, ubw, rgrwu, brrrrr, wrgbb, gwuuwbg, wwbgu, uugbwrww, brwbg, ub, rbru, ruggwr, gwb, ggwrgg, ggurur, rgrrwrbw, wrgw, bugg, gbu, rgu, rwuw, gwg, uuwwu, uwbwww, wuwwbuu, wb, bbrr, rgrgwru, burr, ugurubu, gwu, buurb, wrgg, bugbrw, burbuw, bwr, urr, grgu, ruw, ugbwgw, rbrug, uuugr, buubwr, rurwg, ugrgw, grru, uwwwbur, uuwu, gwrwr, uruuu, urwgugbb, wrurwur, rwr, rgb, brbub, gwr, gwbb, brrbwb, bwwgw, bguw, ug, rru, wrg, uurrg, rww, bbu, wgbb, grw, ubg, uwg, ww, gbwr, rrwugr, wrrgwb, rrw, wbuuuub, wrurggr, bwrb, bbrbrgg, ggggbrw, ugug, wur, wwbr, gubbrwur, wgwgwb, wbbrr, wgw, rbwwbr, w, bbgw, urg, wbgbg, wbr, bbwbw, uu, wgwguw, wu, bgwgu, wub, buu, rb, bgbw, bgwgb, uwgrbu, guw, rbbgu, wru, rubgggwu, gur, rbrgw, gwug, wguwrr, gubbr, rub, rbwu, rgg, bggug, bwugb, rbbbgr, bbbwg, guwrrb, grrggg, bgwu, uuwbru, bbg, rug, uugu, gwugwu, ubb, gub, uubu, bwwrru, guub, wwr, urbgw, uru, wwu, wwwurwwu, bbwg, ubbbwg, gbug, bwbr, wgggwg, urgwub, bub, bg, uwrg, uwr, ubrrb, bug, rggru, rbw, ggrw, bbwwg, gr, gubu, uubbg, bwg, urggw, uuwrrgw, ugg, bbrg, gug, bwggww, grbb, bbbu, rbu, ru, ubuggr, ruuu, uug, uwb, wwwbug, uggwr, gbwuw, grwr, uwuwgbub, wwbw, bww, rbbwwr, bwww, ggggu, ugw, bwwwu, uuwug, wbbggrg, bwb, grbrgwu, bwwu, bw, ruurr, wbg, ubrg, uwuw, brrg, brwuu, gugw, urbggb, bruw, wbwuggw, ggwwr, rbwr, wbrgr, uugg, bbru, ugwuguwu, rwrg, bgwwwrw, uugwg, bwurrr, bwrwr, wwwrggu, bbr, rruwu, rgw, buw, urbrbg, wgg, gbgb, rwu, gubbu, gbgbgbrr, wbw, ubr, wgb, gw, buuwbr, rugrrur, gbuuwwr, rburubg, gbb, ugrgr, wug, ggggb, ggru, brwwg, bwwgrb, gurwubww, ggg, bwgb, bgugbw, rrrww, ggr, gbbb, bgw, bugu, wuu, grgur, rwg + +rugbgbwwbbgrwrbubgugrgbrrbgwrbbgbwurwgrbr +uruuurbrwuwrrrwwurwbrwwguruwgrbgwbbwrugwwgrbr +ggrwuwgruurbwrgrgbwwgwrwguugbrwgwrrrrbrbrbr +gwwbbrugrggrwuuugggwgurbrurbrrggwwbgbwwbbrwwwurwwuu +uuwbubrwbgwwwbwrwbrubgwrwuwugrbrbbburbwwubuuburugwwguwwgu +gwgbububbgbgruwwrubbbgwuuubgububuwgwwrbwgwbgrbugbrbr +gwuuuuruuwurugrwubbuuuuggbrguuurwubuurgbgrrrugruggb +rgbbwbwgbguwubbbbuwrurugwbbgwbwwbruugrwrwbrwurwbbbrb +uubugbburruuuurrurwwuwgrwuwuwrwrwrurwrbbrubrrrbbgggruwr +wggguwwbgwrgubbbwwbgbwrwbgburruruugubrurrbwwgugwrrgrg +uwwwwbruwugburwubguwbbbuuggwbwugurrwwguwggurwbuwwg +uururrgbuwwgwuwurbugwbguuuubbbrruwbwrrwggrurbrbgu +uggwgrwguuwuwrwubbrwgwuuubrbuwgurbwwbuwgggrrbr +wrbwuwrrubbuubwubgwgbwuwrwwbrguguugbubgwwggurwuububbgwugur +uwubrgwwggbugbugggwubrwuuwwggurgwgggggguwrbuuwrrrbwuwub +rggbwgbgbrbgwubwggubbrwgbggugwrgwgggwwgrrrbr +bgburuuwruwwuuguwubwgubgugbrrbwrrbwwuurrwuwgub +rrugrwburgubgbrwbubrbgbruwrbruubgrgrwugwbggbubgrwrrburwgr +wuuuwbwburwrwubrgbbwrwbbuubbbgurgugruwwuwbuwwbw +grrwwrggbuwrbgbuuwrbgrgugrrururbbbwbwbgwbbwbrbgwguurubg +brurgwbuubwwwbgwgggwubwbgrbubguwuwugwwuugrbwgbgrbubwguurw +ugguubgrwwbwwwurbbbuubwbgubburgggbrbwrwwwgbrruubugrwruggrr +grwuwurwrwwrgubwuwwbwwgwbwggbwbuuwubbwurbubrwugwwbwuuwu +wgrbbrwuugbubwbbuuggbbwbguubbbwgwwubrrrgubgubuugbb +uwrbrgbrbbruwuurgbwrguwguuggwwwgbugbgwubwwbgwbwwguubrbrgr +ugugbrgurgguguwubwwuuwbwwbgguwbwwbwwbwrbuwuuwbbwwgrgbr +uwurwgugbbgbuugrwwggwbuwbbruwruugrgrgbugwwgwwww +rrgbbwuwgrwbwrrbbbrwuuggwgugbbbruugbuwguugbgubgrruugbwgwur +bbuggwrbgrwbwguggbrwggwbrbruguurrbuuubwrbr +ugrgububgrburrgbruwbugrguurugrgrbgwwwwbuggrbr +bgrbwbguwbrubbrguwugbgbuuruuubwrguwuubrugwbubrrwgwb +wuwrbgguuwwrgurgwwubuugwurgubrbrrwwbuugrrbr +bgbwbugubbrrwgbbbuububwgwrrbwwuugrrgwgrbr +bgwgbwggwbrbbgbggrrwgwbwwbrwgugrbuwbrububbg +ggggwgwuwubbwuwurbgbwurbguwbgrggbguuuubgrburwbwwbuwuwrgburbr +uuubwrgububwurrbwubrruugwrwgbggggwgrbrrwwrwbuuwwgrgbrurb +gbuwbwuwwgrggwuuuuuguuubruuwrbbrbrubbuguwbwuwbbb +wbwgubbgburrburbbuwbbbburwwwurwbwubrbrrrggrgugggurrbrbr +wburrbggburbuwugrwgrwwuuwrrgwgwuuurubbrwbgugrbggug +bgbgggbrwwgbubgrrrubwwgururggugrruwruurgwgbggw +gbrgwbbwgbbbburgbwbrwgruurwrgwuuruuurggggbuwg +gbguurubwgwguwrggrwwrurubwuruwrbgwrbburuwbuwuuwuurbg +gwgrbwwurguguugugggurggbbgguwrbgrrugbwwwwbrrbgwbuurbbwwr +ugwrbwugrbuwugububgbuugwuwuwgrggurbwwrbwrwrrbubrwwuurgwgg +urwrrwwuwguggubbgwwbrwrgwwuuwugruggbbgurrbrurrgbrrbr +brbrwurgbwrwruwrbbwgwgugrgubugwburgrwugrgwrrgugrugbgrugrbr +gurwwwuguurbrrguguwburwuugwwrbrrurguuubggrrgwrgggug +ugrwrbbrbuwuugrwuwwgwburubwwrgurrgbgwggwgbrbrruugbgwr +uguubguurbuuguwgwrbwrwbggurwgbrbwubrrurbrrrwbuwub +rwwrbgwgwburbubguwrurgwubbuwwguuubbrgwbruwrrbgwrgwr +uruuubwbbbwbrbgggwrwwubuuubrbuwrrbwbwgggwuuwrgbrwuuwbggr +wbgugbwuwrgrugggwwrwbgwbgbbbgbgugrbrrwgbgwuubuwwwgbubrbub +wbuurggbrggubbburbruugrgurgwuwwbggrrurbbugwrrwuuggrwurbr +guugwrwurggwugrgbwbuwwrgggrurbrruguwwuruwbgruwbb +bbuwbugrrbwgrubgbugugwwubbwgwwruguwurgggbubrr +wwbwrrgrrrwbbwrguwrurbbgrrrwgbbrgwbubgwwbuuubbrrwuugwwgwu +rbwbwrrurubrrwubruwururbwguwwbggwbrgwggwgguwwww +rwgrgwugrwwbrgruuwwwuugbrwguwrbbgrubububwgwbwurwubur +rurugbwurubbgrggwbubbwgbwrggwrgrurgbuwrubguubrubu +rbgwbruwrrwgguruwwrugugbwrurwwburuggwwwururbuurrww +guguruurrrurbrgrwugbrrwwrugguwwuruugwguwubr +urbggwrguubrwbwguubrrgwugggbrubbbwgggugrrgwrgwwr +wgurrbuwbrgrururuwgggrrugguururrggggrrgbbburwwugwguggrruw +ugburbggwwrwrbuuuuwbbrwrrrwruuuwbbbgurrugwgbubwgrgrrgw +bbgrgwbgwbwgrbbuwugwwguruggrgururgrwrwgugurbr +rwgwwbguwrwgbuwbrbrgrwuuuggrgrgbbggguruwuuugrrwbgggb +ruubbbuwuubrwuurwrgruwbgurubrrugrrgbuburwwurrbwrbwgubrgww +rwuurggurugbgwguwgbrwgbburuurrbugwrbgwbruuwwburbrbr +uwbbwurgbgggbwbrrwgbgburbugrrwurrbuwgbrwugrbr +rruwwbrruubrwrwrggwrgrgbuuruwguwrgbbrgbgguugrurgw +rgbuubgbrwwrbwrgwubggbbbuubgubruruwwgbrrwuuguubwwgrwbwu +uguugggugrubgruububbbbgwuwggwrgrwrrwwuwbuwbgrrrgwuggurruuu +rgbbwuwubrugbgrgbbrrgggrgbwrruuguurgrbwrrrwrwuggruwuuuww +bbwurwgrbggggwrrggbgrbgwwrrwggwwbuuruggwrggbwuwbwb +rgwbbwuruuurbrrbugwbguwugwrbrgugububrburwrgugg +rbuuwuubgrugwgwgrbwbrbubrbrwrgguwgbggbwuwbgr +bwgurrrbgurbbbuwbgrruuwrbggwbrgwbgrgrrggbrrrbuuwwgrurbr +wugwrwugbbrrrgrwrgruurgwwwgbgwwuubruugugguwrwruru +rwurgwugbuwwuggrwwwwbrbrrwwubbwrwgbrrwbrubrggrrwrgb +uwrbuubburubgubrruwbrbrubububrwgrburwuuurbruwwbbwguugwbr +wbguurugurbbubwgugrbbuurrbuwugrbubbrgrugrbgurrrgbbgb +brrburbrbrgrrwrbwrwbgbwrurrggbuuugbgwrwgurbwggb +uurbbuwgwwuggggubbrwwwgrwwrugrwguwgrurrbgrbr +uurrgbgbgbrrurbgbwwgurwbuggrwbuwrbbrurwrbr +wrggrbwbuwbrrruuwwwuubbgwgbgbuuwrgwgwbbguuugrbbwuwwr +gwuguuruwugbrururuubbuwgrrrrugugwgwgbrrwwrbbbruuruu +rubbgubbbbrwrrwwwrbbubugbgwwurgrbbgugurgbwgrgu +ruwurwgbruwwugggbgwbgubbgrbrubugbrrruuguwbgubrbgrgw +bbwgwgbbbrbwwruruuguwgrwwgrgwrbguwwbrruburruurbr +gugwwwuggrburwwbwwwgugwrbbrrggurrgwuburbruruwwgurbr +ugwbwgbuwwbbrrrrugrugwrwbrwwwugrgbrguwggwuwwrubgub +rurrgubbwgguwruggugguwrgrbwgrbbgurgwwbbggurubuurrgbbubb +rbwgwwgbrburwrwrbururwgguuwgwwwrbgwugguwwgwurwwgwgggururrbr +wbbwbbuugugrrgbgugbgubuububgrwrubggrwbwgrbr +gwugrgbwwurbwbrwrrrbrgwuwrrgbbwwugwggbgbgbbuuu +gwwbuwuwgbubgwgbgggrrgrwuwwugrurugbgrwrwbrgggbggwrrrgbwrb +ubbbwbrwgwubuwbwbgwgrrrurwgbuwwrgubggwuubw +wwbwgbgrwwwwwubbwrgrwbuubbwgbwuruwwruuwgbrwrw +gubbgruurrbwwgbwbbrbuuurrguwwuuggggrburgbgbgwrrbwbgbwurbr +ubwwbgrurwwbgrwbuubuuwuguurbruwgwbgbwbgbrruwguugwrwbbrurrr +brruwuugwgguurbguwruurrbwgwbruwuwgruuuwrgrbwuububrgwbwwgrbr +gwwbwugbrrwubwgugrrgrbrbggwruuuwrgubuugwuwugg +bgbbwrggwuwuruggbwurgubwwrrbwrubuuugbwwwwbbbrr +uurugwbbubrbwrruwrgruwwbbwrbuuuburwrbbbubrwrrruuuwrwwbu +wwbwuwbubwbgugwuuwbwbrurwwbrggwrbrggwgbugubwbwgrbr +brwgwrbguwuuggubgrrubbwubrrgrwwbrgubbrwubggrrrwurr +wruguuwbwgwwbwbwgbuggwbgbbbbrwuurggggbrbug +bbrwbubuuggbrgwbwwrurrruwugrrrbguggrggbbbuugbrrrubrbrbr +uwugugwwbbwwggrrrwgrwwubuwwgurguwruuguwwrggrwrbr +rbwbuuuwgguubrwgrggbbububbggurwubwwrwrwwrbbwubgguwgr +wuwwwuuwrgwuwgbbbguwrurwwggwuwwrwwgrbgbrrubbrrrwgwbwbw +ubuwburwrbgwgguuububugbwbrbgwgburgruububbrwrrugbw +wurbuwrwubwruggwwbrwurbrubwrggwwbuuuwuuugbwgwwgw +gbugbugrbbuuubgbrrwrwrbuguuuuuwburwbrbrrbwrbggr +gbwbggbbrurgwwwwgbwubbbgbrggbrbugbbgwbrbwwbggrugbbgg +ubgwurgwwurububwbwubgrbbrwugrrbgbbgrugrbbuwubu +uwwrubbgbggbguruwuuwrbubuwrbuwbrrwuuugrbug +wguubgbgbrrurwwgwbbbruwwbwggruuwwbrrrgwrbwgbuwrwb +ugrgrrbuwbwubgrrrbgrgbbwuuwugwggggwgrwrgurbgwuwuubgrubb +gbgggbwrbgrbrrbwgwbuubgbbgwuwbrrbwgugbggrbuuwbrr +grggugrguuwuugguwwuwrwrruwbbgugburwwgrgwgwrwugbugrgrbr +bbuwrbrgrbuuggbgbugugwruwbuwbrgurgurruuubuuru +grrgbbuwugrrggggwbgwbguuuubuwuurgwrwuggggrbrbbr +ggguugwugbbwbbbbubbuwwwuggwwugrwbruuuurggwbburrru +uwgwgurbburuuwrwggrrurgbruuurwrruwgwbwbgbubbwbggrbwrgub +gbgurrbruwbwbwrwbrrruwbbbubrbrrwgrrrrgburwbbuwrbuu +wuuuwubrwbggrwugbwbgruwbbuubgbguuwbwgbrwrrubuugggbwgrgrbr +brrruwrubrgrbgrububbugwwwrgbubwwbrbgggwbrgur +bguwgbbbgwbbbbgurwuguwuwbuwuwbgrrubrbgrrubrww +bgrbgwwbwbrubbubbbbbwbbrwrbrrwbwwguwrubgbwuwburgwbrurbr +uwugggbrwuwwrbuurggbwbwgurbrguggrugrwurrgugbrgwggwrguw +ubbrgggrrgwubbrwgwrwrgrururrbwwgbgurbrrrugubwwgbu +bugrwggwbwgbbgbgrugbbwurrwwrbuburuwubwbwwwwgrbr +rugguwururrgwwuwgbgrrbbrgrrbgrwuuggbbbbrgbbbw +rrgbrgurgwwwrrubgggwugwggrbgubwwggguurrwurbr +grgrwgbrrgbuwwrrrwbgrugruwrgurwugrggwuguru +gbububbrbrwubguurggurbuuwugrrwubwbbgugbugrrrrgubru +wrbrwwwuwwwwgubrwrbgrbgbrbbbbwruwrbbwrrbgwruubbrrrgwgg +urrububbruuuwuurubggbbrwrwwbbrwugubrgugurubbrr +ggubbgwwuuwurbubbgggbugugurwgwbrwgbrgrrbuuburgguww +rrrwwburwurubrrrrwwrbgwbbbuwuwrubbuguuubrbwrrbwgrb +rrwbwuruwbbbruwuuubggugruugwwbwbrbrrrwwgwbrr +wwbuuuwuurgbrgbugrwbguwgrrrbuuruuuwbwuwugbwb +ggbuwgrburbwrgbwbwgwurwurbbwbuwuuuwuguwrrrugu +ubwgbrbgugburggrrgburbrrbburggrugubwuurbgubbbwrburu +gwubgwwubwruwrgburwgwuugbgwbrgbgwbuwugbggrrgrrgrbr +ggbgbbgwbuwurrruuwuubuwwgwbbrbwrgrburwrwbbbbugrwrrurwwrbr +wrbggruwrwrbbwgurrbwgwwrwbgrggbrrugubugrrruwrgrwbbbb +wwwgugbwrrbugwbwrggrrrrgurgugbuggwbgbgbrwgbuu +rrrwrwgwwggwuuubgguwrurbrwburgwrwbbrgbbwbwuwuuuwbgugwr +bbgrwuwrbuuwwwrugruuuggrrubrwwwbuwwugwburwbrwrwwuwb +uwrgrgwwrgwbgbbwwggrgwrggruuwruurrgwbggwubgrwww +wrggrwurbrruwwurwbgrwguwbgrurgrrgwgurbugrrgbr +bwuwrbguubgrrrbbubbbwbburgwgwbwrggwgugrgguuggrgbuwgb +ugugwwuugwrbwurbwrrruubrwurbrguwwuuguwbrwuurgggbugbbbubrg +gbwwrruruuuwgbwwgbuuuuurwruwgrrgubbrubgwgwwuwgubbwbwgbw +rwbuburrbwgwbubbuuwbrrwgbwrurwbwggrugbbrrrurrbrbg +uurwwubbwbrubgwubrgugwbubgubwruwwrugbwwrugrurgbgwbbu +rwuuuurguruuuuugwbbbbggggggwrbwgwwwruuwrrwgrwburbr +bgruruwwubgugruugugwbburrgwgbggruuubwbwbwburwbrrgbbw +ggrrrwggbgugbuwwgwwubbrurubguwuugbwwbgrwbgubrggruwruuu +ubuwruuwgwburgrgwrubbbubuwgrgburwuwgwurgwb +wgwrggwbuubuwgrgbgrrbubbbbbwrbrwwwwurwrwbuwgwrgbruuwrwrwwrbr +rrugrgwgwgggwbubrgrubgrwbwgbbwwwrrgbuurwwrbrw +uwburbuwgbrrgggggrbbrgwuurrwbbuurbrgrgubwbwwrubrwbbrbrrbr +wggrububrguubwggbrgbrwrrgugggrrrrbgbrgwbugurwruwburbwrb +gwrwugururbwwbrbrrbgrgggrbrbrguwuuugwbugrbu +rbubwrwbrrgrrbgrwubuwrwwwuruwrgwbwrwugubgrrrbr +uwrguugrbgwgrbgrbuwwwrubuwbrgbwrrrwgwwgrbwgwgrbbrgbugrgrw +ubwwrguwurrubwwbrgrwurruwwruggggugrgubrugwrwgg +rurrbrgrrrbwuuburbwrgbwbrwuwbubugbbubgubrrwgbururwwrurbr +wgbwguwwbubrburrbbguguwrrrurwgbgbububgwggrbwguuwrrbwrwruub +gwbrwgggbbgubwurrgguurbugwbwuwurbwuwubuggubrwuug +bbgrbwrwgbgugbgrwrrgguuubuwuurwgwgrubrbubggubgrrwrb +wuubuggggwgbwrurbwggbrbggrgruwwuwbgwbbwbwbrwb +uuwbrwrgrwwruwwgrwrgwrrgrugbwrbgwwwruuggugubru +wuggbgbwwurwbrbbwbubbwwbbwwrrbbgbuwgugburwrwbwwbbgg +bbuggurwrurrugbbgrwrwwbgwbugwrrguubbgwwbubwbbruwru +rgubbrwurbrbrbrrgrubgrwrbruwrurgbuwbwbbbbrbr +wguruwggwurwwwgbubggubuguubgurruurrwbbuugguurbwurru +bbrgrbbwrwbwwwwwgrwwruggrrbgwubbuwggwbrubgrbr +gbguburgwwwgburwbrgwggrugururwggburubuuwbuwwg +ruuwwwgbgguubgrbgwrubruwrbgbbwrrubguuurwru +bbuwbuwwrwuruwbgrururgguurwrwwbwwrrwwwwrugrrwbrbr +urgrubbgrwwuggwgguruwrgwwrbrgbgugbbrwwbbuwbrbr +ugrruwurbugurrbuwrwruguwbubgubuuggguwurrrwrbwguwrrr +gubwwbrrbgwuwuwbuwrrbwggwurgubuugwbgbugurwgrbrgbrbr +wuwbrubwwrbgbbbubbggwburwurgurbwrurwrrrgwugbwgwg +ugrbgububuwuwburwbbuwburbuwbgwrwugwwuwwubguurbguurggu +wbwwrgubrwwwrgwbbbgbguuuubbggbwuruuwwwwrrww +rbrgurrrrwrgruuwwwwubrgubrggrugbuwrgwuurbr +buubwugwwrggrrgrguuwrgwrbbruugburrurbbruuu +bgurgwrwurrubrggubburgwurbwgbwruuwgbwwgwwbwwggrburbuub +wbbgwuggrrggrwrruggrgwubuugbbbguwubgwrwgbwbwrwwgrbgwwguuwb +wurbbggwgbruuwurbbgrrugwuguwuuububrgbuwrwwwrwwgw +rwbwuwrgrwwbgurrruwgwwgrbwbrgwwwwububggbgguwrwbguu +rrwgugbrbggrgwwrwbugrwwuggrurgggubuubruwrgrbr +bgwwuwuuruggbuwgggbgruguguwgbgwguuwwuwuwgrrgruwwbugrbr +rgwggrbuggwrgurguwrrwrgbbuuubbggwgwrwuuwgrwurgruubwgrwgbu +ruwrwbgwbuurwwguruggggrrbbubuwgubgbbggbgrbrrbrwurwrbr +wwgwwrwbwbrguurugggbwbgbruuburbgrbrubrgggbbbruuuugr +urgubbbrggrbburrruubrbrugurggrwbwuuwwurgrbrubr +bguuubrbbgrgwwgurbuuwbwgbruwggbgwgbugrurrgwrrb +rwuggubgrrbugbuugbrrbubwwrrgurrwbbwwuurrbgbwbggggguwggbgb +uwwuguugbwrwwuuuugrrwuuruwurrrbgrgwbuurrurrbbgrrwwrububwr +bbbrwgrwrgbwgrbwwubugrurwuugrwwgwgrwguurgwgurwr +rbgwbgwwwwbwurrrwrwubgggbuguurbrgwururbrbr +gwgugrgbggrgubwwggwwugugbwwwuwubwruuwbbuwwwgb +wbbuwrwgrgbrguuruugrrugwrgubgurwubwwrbrbr +ugbuggugbbbwrbgwwbrbggwrgwugubwbgwwbbbguwrbugbr +gubrruwrwrgwbgwbwwbugbggurwgubgrwububgbbgwuwurbbugwbr +ubgrwwbruuwbbwggugwrguburrrgurugubwrgrwbbgwr +grgrwbbuwwrrgrgwubwwbbugrwrgrwbgbuburrrrbbrbbwrubwgb +uwrurbgrgugwugrgggwrwgwrbwrgbwuguwuwuwgbubwggbwrwbrbr +wwubggrrgbbuwgwrrurbgrbugbwurrruwrbbugguggbwb +urwggrrrrbgbrwbrwbugrrwbrubbbgbgubuuwuugrbwrugbg +wurrubgwbwrwgwggrwbrgwgggburgbuuurrrubrbbb +urbrubwgruwrgrwururwrggbgggrrurgguwwgbruwruubbbwgbwwwbwwbg +buwrbggggwgwuwbrgugrgbuwuuwwrgwuwbbrrrbugrwuuuwguguwgrbr +ubwgrwwwuuruwurbrwwggrwwbubbbwbwbburgbbrbr +ggbuuubbggrrugugbuguuruurbrbburguwwbrurwrwwbrbru +rgwwrbbguwbwrububurwrgurwuwwggbrrrwuuwwugbrrurrgbrgw +wrrugrgbguuburrrrugwugwuggwbwbbuwgwuruguwrrwg +ububbwgubbwgbwrrrubbguruuuwgrwbubbrurwrgwgugur +urrrbuubwwwwggrgbwgwrwbrgguwurbubguwrwuubgruurwur +wrggurrwwugbwgbguwuugwuguwugbrurbbbbwuwwuugwgwwwgrbr +gwwrurwubburbugwwwugbwburubbrwrrwurbruuwwbrgbgwguwwrbr +grubuuuuwbgrugurwburubrurugbbrrggurruwwwurwwubwbrrggrbr +rrbbuugrwuguubrrrbuburrwbggugbwrbuuubruwggruburbrgwbu +wbwgrruwgugbwgrugggbruwbrwrrbbbugrwuwbgwubrwgwwwbugwbrbr +guwruwwrrurruwuubgrgrwwgwugbbbrugwurugbrwwbrb +guuwwrurwwwrrruwbrrrrwgbrbubwrrwuwrwbwbbbwuwwb +gwgrwubguugwwbbgbugbwgurubggbbbgggbgbrrwwrwgwwggg +gbbgrbrbwrgbgrbwrbrbgrwwrwbrrwrrwubwwubwgwrubwwrgbrrbbwuww +bwugbgurrwwrwrbwbwrurbgwrrburgurugwwbwwuubgb +uwbbrbwuuuuburururwrrwbrwrwbwrgruugbuugwrugbbgwbuuwwgugbu +buugurwuuguwwrubgrggwgrwuguwrrgwubwbbwuuuuugrruwbwrgbruuru +rbwwwbwwbggruuuwurubgbgbggbubbwbwgrgbgubbugbubwbrwgrbr +rrrruubrrrwugbuuwguruuburrwgbwgwrbrubrbr +wbrbwwbrrugwbbbubgbbgubrgbugbwgguwrwgrugrguuwggrggruwwrgg +ubrugbrrgbgbrrbbwuwugrgburwrbggruurrgwgbrgbggwbruururg +brubggrugburbbrbrbuuwuurrgbugbbgwbrwubrggrb +rgrrguggbgrbbggbrurruwwgugwururbuurgwuurwbwwugggrbr +grbbuuwubrubgwbwbrbuwubwubuugwuwguwwgbgruug +rbbwbrwggbuubbburuwgrrbbggwwubgguguwgubgwuwrwrguugugbwbbrbr +rubbwbubgbuuwgugbbbwbrgrgrgwrwubwrgwwuururubwrbr +rrbbbbbgrwugubbgwugubgbggrrwbbuuwwbguwubgg +brbwgwbbbbgwbwbgbbbbgwwwuuwrruggwrwburubruugb +rwgwubbuurwrwgwugguguuuwurwrwgruwrgbwbwwbrwwurw +gbuggggruuwggrrwurwggbbugwuuuubgwbgurgbbrbgwbbuwburw +wurwwrguubwwwwuwrgurgugrbrbbbrrwuwwrwwwbrgurbrggrgggurw +uuwwgbuwgruwwrwugurbggwrrurrwwrrrwrwgggubwubgbbr +wuubgwgrugwbbwbwwgrbgurrgurrbgurrurwurbwuwwbg +wugbugwuwubbwbrguguwgwbuuwbwrugbwgrwrbubwwwbwwbrgggg +wrurwububgwrguuwbgugbrbbbuwgububbrgbrbrbbr +rrrwbugwwggwuurbuuwgwugugurrwbbwwbrgrubrwbbggbgwrgbrbu +gubgrbruuguwrwbbrwgwwbbbrgwwbbrgrbbgubwrgrrbburguurrb +wuwbburbrgggwbbrwwgwguburrgburrwuurubgbuburrwrbwwwbwgbub +burubrruruuugwwwbrubrbwwrrubwubgrurruguwwurggbugwguwgrurg +rrggruuuwbrwgbgrrugbuuuwggwrgbrbgbwbuubrrguwwgubguubuuwwub +uuggubguubrwuwbrwwwgubrwrbugurbwgubgrgguugb +ugrbwuurrrgwrrrbrgubbgrburubwgugbwwgruwwbugwwubwuggrwggu +rwbwbuggwuugwggurrurrbwgubbwrwugubugwuwgbgbruwuguwurrguwgw +gbgwbubrbwubugwgwrgbgwwbbgwrruwwwrbuwbbwubrggwrwg +rrbrgwuwgwwwgbrugugruggwrggrrwuggwbguwruwbrggrggwbwb +ubbggwgbrbggurrrwrurugwurbggbgbrwurgrburwb +urwwwbwbgurwgbubrgbwbwwwgrgrrurbbrwbruwrwrurubgwwrgrgb +rwwuurubgggrrggubbwbbwuruwrgbrgubrburgrgwgb +ubrwbubwwgrbbwbrugugurrrwbbuguubururbrbwrwuwbuubg +bubwbwgbwrbuwbwuggwgwwbrwrwggruuurwwwugbrbwur +ruububgrwwubrurwrguwuwubuwbgubggbuwbgwrrwuubwwubgbgwwwu +gubuwbbbwrbguuggbwwgwwgubgrwrgbuwgrgrgrrgrbr +guwbggbuwgbgwuwurwgrbuwggugrururruugwguwug +wwrwruuuwggbrugwrbbgbbugwbubbuggbgwwwwbwuwruwrbggbbw +wrwguwuuugbrbbrwwwbgwubwrgwbrrwuwrwwuwwbrbbgrrurwbbbbw +gbuubwruwrrggwruuwbbburbbbubwugggwgugubgrbubwgwwgbrbr +brbrrugwbruurwwubbgbrwrruwggrggwubgrbrgubgwwggwggruubrgrbr +rrrburwbrbuuwubwubrbwrgubrwgurrurbbgrwggrgwrwrwbwrgbgbrbr +bbwrgrbwwgubgbrububwubuwrwguubwgrgrwuggwbgggrgwwgbubwbu +rbbururbuwgguurubrbgurwwuwugbwbwwrgbrrguuurwggwwgur +grwggrwwgrurrrurgbbgrgwbbubrruwururruubgrgwwgg +bbwwrbwwubgugrwrwgbugwgguwgrwbggruugrwugrrggburbb +wgwwbbuggbrbbgrurwwbwrwrrrwguuugrwggbgbgbbbugrbgrbr +grbwurgbbugubwwbwwwuwrrggwuurubrggguugurgrrurubugrgrugwgw +wrbgggrbuuwbrwrguwggwugwbrgwbwugwguwugbbgrrbr +urrwwwwrrgwwbbggugwgwbgubwguwwwwuwbrgruurwburbrbrbr +wurubwgwbrgrbrgrubbgwuwbuuwwrrgbugrgbwrwuruw +gbwbuubrugbwguggbrubwugugbwrwguruwbguubwuwguurwbrgwgwguw +grwgwwbbbwrgggburgbuugrbruburwwggrwgwgwubgwrubb +ugrubbwbrwububuuugubgrrurrbrwuuuwubrugubbbggrruwggbbg +gurbrgubrubuggburrwgwwuuwrrwbubuwwgrrrwbbgrrrw +burubrgruugrbrgrwgggbgggrbggrurugbbbwrgbgrwwugrbr +uggrbbwwgwwrubbbrbbbwwrrgubwwwrubbgwwggugrwguwrwrrrr +brgwwugwgbugwgwbguwgubuubgwgbgwubguruwrgugwuubwgrrwgww +bgguuugrrrurwwwbugbbruwwrwrwbuuwrbuurrubuwbgrwwuuwgbgbubb +bgwgbrbggwgbwuwgguugwrrrguuwgbrrrbwrubugruuwuuuuwguwbw +wwbuuwwgbguwbrbggbwwuruuuwgubwbuwrwwugrbr +ugwrwgururburbrrgubggbbbgrbrbugurbuggrbrwbub +gbwrrurwgwrgwgrbugwwuwrbguwbbbugbrgwrrrwgguruwrugbr +guurrrwbgguwrwbuguruuwguuwrbubuubwuwbrguubrwwbruububrgubr +wwbwubububbrwbrrbuubbwrgruuwrggwbwwwuggwgrugbb +urwwwwubbbwgbrgurubrwggwuuwubrggrrwuwrrgbrurgg +gwgruwgruruggwgururgbgrubrwwrrubgggrrrrwruwgwrbuubwurrwuw +urwrwwggrurbbubwbuguwrgrwbbwbubwbruwgrbr +bbwubrgguwrubrggruuuruwbbruwuubugrbwubguuuwgbwwuwww +bwwbwgggbguwgrbruuwgggugwbwrwrwrbggrurugugwrrwwugw +uggbugbbuwggwrrugwbwgwgrrgbugurbwuuwwwgruwrwugruw +uggbguuuggrugrubgwgbrurbbwwbrgubbwuguubugubwbubruugbbbgrg +urwubgbwurrwugurbwrrgbrwgrubgggwurrwurugbwuwbbb +rbwugggwurrrwurrbwwguuububbburrgwuwgwbubrrgrgrwbbwwwrbgb +bbuurrwwugbrbgubruburbwwuuuwwuggugrrbrrgrbbubuugbrbrwwggwb +rubuugrrgwrgbbbubrggruggwgwbbrwgrrwurubwururr +uurrbuuwwubwgurgbbrrruwubggrwgggwwbwwrruwggrubgrwugbr +ubggrgwrugbgburrrwbgrwuwurrgwbbuuubgubwrurgrbr +wrbbwwgbggbubugubgbwrurrurgrugwwbbgwbruggb +gbrbbbgbrbrrwwbbuuggbbwguggwbgwrbgubbrbwwguwwuw +gwwwbrgrgrrubrwbbubgrbburuburugrbgguuuwwgrguwbubw +uguwrwubrgbrggrrbwbggbrwurubugguugbubbwrbugbugrr +bgwrbggbubwwgrwrgrwuuruubbruwrwrwgrrubwwuwbuwwubrbgwubrgug +gbgwurbgbgbuwwwubwgrbuubbgggbubrbruwggwugurwgbuu +brbururuugbgrgrgbgrwrbrurbugrwwrggrwgurubggbuw +rwurubwgrugwwgrbgwgbbugrrbgrbrgggurugwwuwbggwbgw +uwbrrrbguurgwwrbrgugwbbwrrrrggugggbbbggrurw +uggurguwwgbbuuwrgwuurrwrwgburguwrwbububurwwbrbuubbrgurrb +ubwguwubggwbrgrguwwuubrgbbgrwwbguwrgrbrwgrbgwwr +rbbrwurrbrgwrrgrurrbwbuuwwubrgbrgurubrrrbrwgwwurwbwurubww +burgbuuwuwwurwgwrrrwuuurggrbgubgrgwbugwwbgrwubuugrbbwuwbu +bbwrbubuugbwrwwbwgrbbwuruuruuwwrwgbuubggbburbbbwubbguwrrgrbr +grbrbgwwgbrrurwwrggrurrwbbbwgwbuwrbrgwbgggwbbwrbr +brrbwugubbrwurruruwwwgguwrrubruubrbwuwugrb +ubwurrrbuurwwbggruguwwbwwgugbgguwrgbuuuwrrbuwgwb +wwgwuwgubrwuwrrbburwrrbgguuggbrrrugrbbbwwwrbgurbwwuwbbwwu +wwubgugrrwbbbuuwwgbrwubbugruuwurgwgrgbrrgrgbrbgrguru +bubrrugwbrrrrbwuurubwburuwwwbgrwubrbwwgrbuuwrgbrbb +bbbuuuururwbbgrbugwbrwgurwgrurguburwrwgbwgw +uwgbugubrggbgugwbuugwgwuruwwrbugruwwbwwwuwwuwrwgbb +rgwbburubruwwurbbrgugrwgbuwrurwrrgruwugguwwbrrrbr +gugrguwuuruubuuuuuwwgubwubuuuubgbwwbguwbwb +bwwwgurbbrwrwbggrwrgbrrbbrgwgrwbgwrrwubuwgw +ubwguuwburubwbwwbwggubbgubbubgrwwrrwubuuwgwwwbwuwggbwuwgbu +gwwggwwgbgwgwrrurugrubbbgbrbbgwgbwwgrwwgwrw +wubwuwgwwubgwrgbwubrgrrwguurbwuwwruurrwbuwbbbbggbwwrgw +ugwrurrbubbwgwrbgrruuwugrgggrgbuwbbruurubrbr +wwrwwrbuwgruuurguruubgwrbuubrwrgwwbubgurwg +rrwuurwrrwrurugwwbwrwbgrwuwwwwruurrwugugrbuu +wggwbwgbrwuurrwwguuuuubgbuwbbbuuwgwwurrwwuwr +ggurbuugbbwbbrbuwrrbrgwubrbuwbbuubwggwuuubrbbrruwr +rgrrwrbwurubrbbruwwwbwgurbwrbuwburwwwrgrbr +buwrrrruwwwrwwguurgurgrggrurugbrwgrubwwuubgrrwrgbgbbrwwrgu +bwwbruwrwrrrwbgbwubgwgrrwgggwwbbwbbrrrwuwuurbbgrbr +ubbwuuurugurbgrgurwgbrwbwguuwwgwwgwrwbuburgrbuwwbgwggub +guurrguwrrgrgwwwubbbrbggwuwrwrrbggbwbbwgubwrwwgwgwrg +wubugbburbbbbwubrwruurrwuwwguuwwbbbbbrwuguu +rgrrrrrrggbbwguwbrbbwuubbwbwugbrwubrrruggrbr +wbbbrgwrbgbuwuwwgrbrbbbugwwurggurgrrugrubbbwuwurbug +uuwgwwwrwbubgbwbgwgbbwrguwrbuwggwgbbwwbugbbrwburruw +rrguwrrwwwrbwuugbuurbuwuwwubruruggrrwwrbbuwrgubgrbr +bwgrwrwubugugwrurrwuguggrwrbbbrrbwgbggubuwbruwbgwwg +wbbuwwwubwwrbwurubgbwurbrwgguwgggrbubbwugrrruguuu +ggrwgrbuubuuugbguwwrgwburrwrbbuggruguwggwrrrw +ubbgbwwwuwbwbuuwruwgbugrrrgbbgwrggwwrruwwrgrbrrru +bruguugrrwrbwrwubbrgrburruggwuruuwwgbbrurugbg +uwgwrugwrbuurrwrrubuugrrgwrwrwgrbgrrwwurggbwwwruwggrruw +ggruuwwugrgwrbrrrruwbwbwuubgrrwwrbwrbgrgrgubwbgguurw +bbwurgburgbrgwbwrwrwuubuuwuwguggbwbbbubwwruggrwuugwwbggu +bgrrbbwgggurgrgggrbwguwbwrgubbgubuguguwwuubgwwwgbbw +gbgwurgwwrgrburugwguwgbwbggubrwuuurbbbrgrrgugwwrbrubgbwb +rrrbrguubgrrgrrrwrbwrbwwrrguwubbrwurrgguurgwgg +ggwrguuuugguwurwgugbbrbgbgbugbwbwrwrrgugrbr +gwubrwugwwbwuugrgugwgbgrbrwuururubwgbwrbwwbrrwwrrrruwgrrww +uruburwuruuwwbgwbrgrugwrbwgggrruwgbbuwgbuwggbrwg +rurugwwggrbbbbwbwwbgbwugugggrurbrgruwgubrwrwwuwurwugwwb +gwrrrgbwrrbbrwbwrrgubgrbrburrrrrwgubrwgwbbburgrrgwgu +uuwrruurbwuwruubugwuwrgwbbuugrbrggbwruuwbrgbwu +gbugbgrrbugrugguugbwwuwggrrggggrwbrgrggrugurugbgwwurw +wbwbgbggrbbugubbwwrubgbgubwuuurbugrurgurwruwuguwrbr +rbbuwrruwwrugrbrwrbwubuguwgrrbwwgbgrggugwwwbwwgwbrur +gwrgggugrurwuugrrggrgrrbrrrgwguwwbwubguwwgbwguwgurbr +bbrbwubgbgrggbbwugbgbwbgrbbwrggbgugwrgwgwuwggbgurbuwrbr +rurrwuurrururrrggbwrbwggbrrbrugwwbubwwuggurwuubwbububbww +bugbwrrbburrbgbwubrrbbuubgguwrwwguwgugbgwgbrggbbwwbuug +wuruguwubgwwrrbrwgbrguuubwgbbwwbwggwrrgrgrb +bbbubbgwgwgbwguggwbggwggbwubugguurbrgbwurgugwugwgubbbubgbrbr +wbuwrbruwurbwwwrwrgrwruurubwrbwggrguwgrrguggbwwugrruggwrr +ruubrbwwuuwburubuugburrwbugrrruwrrggbgrguwrbwbugwgbrbgbrbr +rbwbugbgruwbwwgwguuwuuwwrbrruubwbuwwwubrgurguuurbru +wrrgbugbbrubwwwuwguuuugggbbbwbugbuwwguwbwruurbuwrbr +rwrwuggwrwurgbuuguurgrwrwgwbbbggwwwbgbubbwg +bguguwwgwgguwrurruwwrruruwwrwwbrwwwwgbbbru +wuurbrruwbwbrrurbwrggurrwrgbgwbwubgwwbrubbuwubwbrbu +brrggbrgbwrwgwbrrrrrgwgurbbbgwwrggbwgguwrrrwrw +bbugruwugwbbbgwrwgbgbgbrrbgugwgguuwbgwwwgrggwwguwggrbggu +bggwrwrwwrbwuurrurgugwguggrrwgugubgwuuwwuwgbrgbbbgu +rgubububwrrruwbgubugbbgruuguugbwwwrbbwgrrrrrbwwgggbgrbggu +rbrgrrrrrrrgugwrburbbrbbwwubugggbbbrbbbwwuwbuwbuguwrbr +brwugwbbubrbbgbbugrbrwbrwgbrwrrgugugruuuggurwwbbu +uwrgugwbgrwugbubugrbubwbggbgwubwugurguwwgwggwrrbwrbr +wbwurgbwbrrbburugwbwbbgrrrubrwgguuubrrrubrbr +wwwwrgrgwwgwwubburrgwruwwrurrrrbrbbwbwbuugrbr +rggbrrwgbggrwgruubuuurbwrruwrgwrgggrugruubbuu diff --git a/output/19-1.txt b/output/19-1.txt new file mode 100644 index 0000000..2c136b2 --- /dev/null +++ b/output/19-1.txt @@ -0,0 +1 @@ +302 \ No newline at end of file diff --git a/output/19-2.txt b/output/19-2.txt new file mode 100644 index 0000000..36fdc43 --- /dev/null +++ b/output/19-2.txt @@ -0,0 +1 @@ +771745460576799 \ No newline at end of file diff --git a/src/main/scala/adventofcode/solutions/Day19.scala b/src/main/scala/adventofcode/solutions/Day19.scala new file mode 100644 index 0000000..a57cfe1 --- /dev/null +++ b/src/main/scala/adventofcode/solutions/Day19.scala @@ -0,0 +1,29 @@ +package adventofcode.solutions + +import adventofcode.Definitions.* + +@main def Day19 = Day(19) { (input, part) => + + val (patterns, designs) = input.split(lineSeparator * 2).toSeq match + case Seq(a, b) => (a.split(", ").toSeq, b.split(lineSeparator).toSeq) + + def countPossible(remaining: String, cache: Map[String, Long]): (Long, Map[String, Long]) = + if !cache.contains(remaining) then + if remaining.isEmpty then + (1, cache) + else + val (count, newCache) = patterns.filter(remaining.startsWith).foldLeft((0L, cache)) { case ((accCount, accCache), p) => + val (newCount, newCache) = countPossible(remaining.substring(p.length, remaining.length), accCache) + (accCount + newCount, newCache) + } + (count, newCache + (remaining -> count)) + else + (cache(remaining), cache) + + val counts = designs.map(countPossible(_, Map.empty)._1) + + part(1) = counts.count(_ > 0) + + part(2) = counts.sum + +}