2024 Day 19 Complete!

This commit is contained in:
Brian Buller 2024-12-19 07:29:13 -06:00
parent 130904c604
commit 8e9d8dd42c
4 changed files with 513 additions and 1 deletions

402
2024/day19/input Normal file
View File

@ -0,0 +1,402 @@
rrgwru, gwubwg, wgbbw, bwb, ugrgw, uwgguuw, wuggb, bgwb, ubrr, grruuub, rwbwgbub, wwwggg, uuw, gubuu, urwb, bubg, bubb, rruruuu, ubgr, uw, urugg, wubuu, brwb, buw, bgug, wgbwwrb, rwrgrr, gwgr, rrwrg, wwbwgbw, gguu, rgg, bwg, ruurrwg, wbu, ggg, wrw, brbw, wbb, rrbgg, gbb, gwwrubwu, rwgu, grgwwu, wguu, rwg, wbwug, rbur, gwg, wbrugu, wbwwgu, wbbuw, rwrg, rgru, rgb, bwwrg, bwur, rrubwu, gwb, ugwur, wbguwb, rbu, ubrwgw, ruwbr, wbbu, rrbwbg, rgub, rwgb, urwg, bbw, bugg, rugwg, rwbrwww, wuru, guu, brwbg, ug, ruuwruw, bguww, wwrgrurg, rrbgr, uubwurb, brrrwgg, bur, urg, rbg, wruw, gr, ugb, wwrbgrg, wbuuw, bbugu, uug, rrbb, rrbw, bgr, wwwru, rgu, urr, rg, wbgbru, brrgu, gubu, rurgr, wwbrgg, ruurwgwg, rbb, rbrugwb, gwwrbg, bwuuwrg, wu, b, bgwrb, uwggr, rgbb, rww, wgwb, gwgwr, uwbb, uww, gu, ubwuu, wbwwwug, rurwru, rr, rrg, uggr, bgwu, wbgbu, urggw, br, gubgugr, wgrb, bbgrrbu, brbg, wrg, bgrb, rwbwwur, uwr, bubu, grwb, ubb, wr, bbbgwr, bug, uwgwuwu, grb, bgw, uuu, ugr, wgbbgu, gbg, bgwub, urbgrw, rbruwg, gb, bbwgwur, uwbgwrr, ggrb, wbrrwrbu, gbbugrb, ub, rwb, gwr, ruwu, gurgu, rru, uuwwgwuw, bw, ruwbbb, rbgrgu, wuwu, grrugr, wgr, rbbr, rugr, rrrrbww, bwrr, wrbbr, uuwgr, gug, wwb, rgur, brbrr, gguw, grwubrg, rrrr, uwb, wuwwrrwg, gwbggr, rwrub, wuur, gub, rbgb, urrbubrr, uwubu, brbb, bwbr, bww, ruuubwu, ugbbbr, bub, rrug, wub, gruu, uu, bbu, gbbr, urrg, buwu, grw, grbbbu, bgb, ugubg, uwww, urw, wwubruww, buurb, www, bguurr, wwgu, wgb, ruwub, wggggbg, urrb, gbwuw, ubrrg, wrr, gbubgg, gw, wuw, wuug, wwrb, wgg, rgugrru, rgwrbr, guurrg, bgu, rurgb, gwggb, bwgbbw, ggwb, ubwgw, bbg, rbr, wgru, urwr, brr, rgbr, rgr, wwg, guwuru, uuggg, rrw, buu, urb, guwg, ugwwbuwb, rubb, brbuww, rwugru, ubu, wwub, bgwgb, wrug, rug, w, brgg, wwugwruw, ggrwb, bbwuwuu, uub, rrr, ggbrr, wbur, wurbru, wgu, brb, urbbb, gburbww, wbrgruru, rbugr, gubw, wgwgg, rwr, ugw, gggg, gwrwrg, rrub, gbwgg, grg, uwuur, gbwbbb, guw, gbwbb, uwu, ruw, bwr, rwgub, rbw, ggbwr, u, gwu, rrurrb, gwgg, uugwrbr, brw, ugburg, rwu, wwu, wbr, ruwgr, gbwbur, rwgr, rwbww, rbgr, rgbub, rbbuw, ruu, bwgw, bbwg, ubr, gurr, wwr, wwwguu, gbw, ggw, gru, wug, rubwrbrr, wbrrrr, uru, wbgw, wgur, uurgg, bbb, rbwgwbur, wwbwur, bbgubw, gww, brg, ugu, rgrgw, wwrrgugu, rrrwuww, uwwrb, wrb, rrgg, wubgrrb, bwwgrbww, gbr, gwrwu, brgwwbu, urrwub, rbru, bwrgrr, brwuwrb, guuur, wb, bbrb, brww, wuwrww, bu, rgw, rwbwug, bbug, urrgr, bg, bgg, wbgwbgru, wbrru, uwbbr, wbg, gwwur, gur, ubwb, gubbb, bb, wrugr, grur, rb, uwubrg, bwgrw, gbug, g, wuwubgw, ubw, urgu, rrrg, uwg, bbww, uwgrug, ww, ggu, gwbuwu, rgggwgr, wugw, gbrrg, ugg, bwu, ubuur, uurrw, uwwug, bgww, ubg, rw, gwgbwrg, wuu, rbgbg, buwbur, rub, ugbwwrgu, gbww, wbw, gurbwu, bruw, rggrbrgw, wguwu, ubwbwr, ru, uwur, ggb, uurwg, wguubgr, wru, rbrbr, rbwr, wwwrbb, urww, rur, bru, bbbwrw, uwrwrr, ruww, ububbgr, rrb, bggrwg, bbr, wrwrb, bwgwrbg, grbuwg, gg, ubuurwg, uur, guguwb, rugurgbw, bbuwbb
wrbwgruugbbgwwurggwrgrrrurbgwbgggwbbgwgbrwggwur
bururbrguwurbguwrubbbbbuburuuuwbgbgrwggbugrwrwurwwbrb
wgwgwbwuggbbwbrbgrwwgwbrbwbrbggrrgburbubwwur
wguwuugubwggburwwbbbbwrgwbrwuubgbbrugrbrrbrrugwuwguwrwwwur
rubwururuggurrgbgrburbrgbuuuuurwgubbbrbuwwbgbwgwrb
rwrwguwuwgbruwurgbwbgrugwgrggwwrrgrbwrurrrrgbrgbbgwggwb
buggrbwwurwuwbwrrwgubuwgburrrwbwubugugwurrbwgwburwubuurwbb
ggwgwrrwbrbgggbubwgwgguurbwwwggbuwbrubuubrrwur
uugugbrwbbwuugwwuwugurbuugbrugrrgbwgugggrgggrgrur
bwrubgugbuugbwrwbbubbgbugbbgruubwrwgubwguubbbugu
wrgrwwgbgubrrwbbgbwuurgbbwrrgwrrwuugrgubwrgrwbwbbbwrgrbb
rwbwwwgrgbrbgwurwbwwrrguwbrbwgrubrubguwurg
rbggguwguwrbgbbruruwgguuwwwrwbugwbbbbrrwgwb
wburgubbbrbgugwurbgrrwgbbuggbrggbrbubrwbrrwur
wgwrwurgrbwgwwuwrgwwbubwbubwbubggwbwgbwwgr
bgbbbgwwgbggrububrubbwwwguruurbbwwububwugwwuburgwurgrwr
rugwgbugbwbbrbgbwrbgwgurbuuwbbwbwbwbguugruwbrrrugwwu
rwbgruguuurwbubwrbrbwwrwurguwuwbbgggrurbgbgbwwwggwu
ubwubgbbrgbbbbgwwurgbuwuubgurwrggrrrgrbbbgggbrbb
wuuruwbwubrwgwuurugbrbwgubruuwwurwgwrbrugwrrbuuuww
ugwgbwrggrwwuwbgwwrubwuubrbrbwgbbwgbubburuguwguww
grbguwwuwgrburgggguugubwwgwguuwbwuwuwgugwggggwurrubwgbbwrb
buwbuwubrrugrrurwrwwbbbrugurgwguwugwwbrurrwbrgrg
gwwgggurwbwggwwbwrrgwwgurubrubbrbuuruurwur
rruguggbrrgwgwgrwbwwwugrbrubgruugrgwgubrgwbubwbrw
grbbbwrrugwrwwurwguugugguwuwggruubrgubguuurubrgrrruwub
wwrwguwwurbwuwwrrwgwggbgwruugbbrgruubwrwur
bgbwwwbbubrugwgubbgbggburrwggbbggbrbgwrrrbrgurwur
gwbwurgrwwbrgrubwgruubbrugbruruwuwgrubugwg
uguugbrbuuugbwwrgubrwgwrgggwrrgbrrbwbuwwwwbgbuwurbrbr
ugbggbwuwrgwugurggrugbrgwbwwbgbrwugubgrwrbuuwgrurwgguugwwwur
uwrwuggbuwwbururwgbrggwgwubburwwggguwwrrggwu
grrwwwrugbwuubrggrwgrwuuuwgwrwrbugrrrwubgwggwbguurbw
rgbuuwbgwgwuwurrgwrgugruwgwbgggbuugugbbwwrwugwrurubwr
gwguwrwgbbruuwrbbubburwgrrrrrwburrwuwrwgwgwur
bgbbuuguggrgrwugruwrbuuuuurwgbwbbubwrrggwrbw
rwwurubruwuwbrbwugrwbgwwuwwuuwuwurwwgwbrwgubgrruuurugwgg
wbwguwbrruruuwubggrbggwggugurgwgbrbugbwwbrbwuguuugr
uguuwrrbrwugrwwbbuwwrgbrwgbwubbubgwwbuuwgrwuwggbwr
wguwwrbbggrugbwrugbububgurrubggbwwugubbubuuguggrwur
uuurbwwwguurrbrgrrrbwgbwuuuwurwbuwgurwguugwrwggb
urrgwwwbuuwrwugrurgwgggrgbwuugruruuwwubruwwbru
wugugbguguwugbwgrgbrugrwwgrbwrgwwubruwwrggggwur
brubbgbwubwugbrruwububuuwbbwbrugwrbbrrggrgwrugrrwbbrrub
gwwruubbrrbbrwuubrwrrgwuwrgbuuwgggbburgwurrwbuuuub
wbugwuwbbwwwggrwwbgwuggbwuuwwgwuwbrubwrgubwurwwrguur
urgrgwrurbwggguubwuuwrbbwrgggggugurgggbbwbbwgwuu
wwgubrruggbgrwbggwbrubwggbwuuuwbbrwgbgbbbrbwruwwwwurw
wuurrggguwwbgbgubugrbwgwgggrwbwgbubuwwbbrwbuurwgwguwgurwur
rgrggggggbwrrbgggguurbbbubugbururrgrrrbbgwugbwrbgubb
rbburbururrbrurrwgrwrruwubwbgrrurgrubuwwur
bgguburbbruwugrurubbubgbggwgbgrrgwgwbguguwgubrrgwrbrwur
rrrwrbgwwrubwuwurgrrwbruwuwbgwbuguurgbrbrgwur
rrgbbgrurgrgrbrwggbubbbubbwgbuuwwugbrwgwrgwbru
bwggrguguburbbrwurrbgrgbgwwrwrrrwuwgwgbggwrggubwbgubbwurbb
gbwuwwgggrgwbbrrbuuruwubwrubgubwwbgwbgrbgurbg
bbwgrbbgwurwbrgbggwbwgwurburbburgugurbbbwbbbggrbu
urwgrwgguuuwruuwrbuggggwurbrbgwrbwbggwur
wbgrurwuwgugbuwgrwrwbbgrbbburwggugugrrgbrbbwrbbrruuwgwur
ubbuggwrwrgggrugwuwwuwrgruwwbrwruuugwgrrurgurrrbbugbr
uuugrwugwuuwurgwbrgwgugrrwbrrwrbuururubguuwrbwugrbbrgwur
ubrwgrruuugwgbrgbgwgugrbwwurgbwrbgwuubbuwrbgwwwwur
gguubbgggggwwwwrrrbwwubggwuggubguuuubwwugrrrgguwrbwrwwrwur
bgwuuuggwgbbbgwugwuuuwububgurgbwbbwbuwrbuwgrgg
buwwrrurugrgbgbubuwbgwgurbrrguwuwwurwwgrurrwrbwggrrbrrgrg
urggwurbbubbrubrggwgbbwbuubgggbggrwbwrrwburubg
rbuurgbbrrgbuwwrwgurrbgbrurwgbbrrbgbwbgbbwwuwwb
ugbggurgguuurggguuubgurrgurbuwrrgbgwwgbwwbwwrgbggrwwrbrbrb
wbwbubbrwubwggwuugrgubbuguwgurruugrrbwbbuwbgb
ubuggruwrwgwbubuuuubuwwgwrbuurbuwgwgruwgrgrurwrrrwgwbuwg
bwuuwubuwrwbwbubwgbwwwbwubgugugrugwrrrwgwbgw
ruwurrbgbuwrwrbwrbguwbgrbrrubugbubbwugrrbgubggbrugw
wggrwwgwurbgggbgubgrwggwbwbrbggwwbrrurwbbguwurgb
bwbgbbuwwruggbgrrrbbwbgrbbuwuuuugbwgggwwwgbwbbbwubwu
wrrbgbbbguwgrwrrrgbbugrruuuwbgwgbgwurbbuwrugg
bggrbrgwgrurwgubgwwwwuwbbuururugwwrbrgrbubwwur
ubbwwrwrwurwgbwrwwggwgggburbgggbuwrwbbwrubrubgugbrwwuw
rbguwwbrgrrbbwuuwwgurbwbrwbbbuuubrwrggwwubbgrrwgrrwuwu
wurrurgbwbgbwbrrubbrggbwgbwrwbuubgrbuwuwrbgrgrbw
rrbgbrurwrwugbgwwrggbrgbwugurwrbwwrubugubwru
guwbrgbuuurrguurgugwgwwrwwbrgbgwwwgbbgguwwwur
gggbrwguwguwgwurrgurruuuubrruggwrgbubugurrbububgrw
ggrburwwubbwwrwgbgggurrbgggwgrrbrbbbbwugbwrbrwubur
bbbgrugwwgwggbruwrgwwbgrbbuubuguwbggwwugbuugwbwrubgguuwwg
guwgwbggruuwgrwgrbwgrrwurwgbgwwurgubrubgbuubrwwwuw
rguwrbbrbubuguurbgwburguwbwbwgwggbgwgwwuwubrwruu
uguggubuwrwrugrwwuuuguguwwrwrbgwbwbwwggurbbggbrbguwwgubwwur
bggwbuuwurgbwbrbwbbrrgwwgugrrugubbrbggbrrwug
bwrruwuguwwgbwwrrbbgrrrrrrgugbwwrrgbuuwuwrwr
bgwbugbuwwrwwrwburwwgbgbwubrbrwgbugrruuugbbbrgurbwub
ruguuwgbrrguuuwbbwwbgbgrbwgwgbwbwwrbruubrw
rguwwwggbrwbruuwwbubbbbgbbwgrwgwggggrggwbgg
ruwrugwwbuwbwwwbrwbggwburrwwururguruuguguwgrbu
bgugbrbgggbbwugwbwuurbubruwwbrbbbgrgwrgrgggrbwrg
wbrgrgbrwbwbrwuuwbrbbwrwrrwbgwggubrbrbwrrgrbuwwr
grwuwgugrwbgrgwwbwwbggwgrwrgubgrrruuburrurwwrwbrrggwgwwbgwur
ubwbwbrrbgrgwuuwgwubgggrgurwuwbrwggurrgrgurrwubrubbw
rbrgwuwggbbubruruuuubbggwrgurrwrwwuwrgguurr
urgurgubgrgubwgugwrbuugrwrgwbgwwwwubrwwbguggrrrrrb
grrurbuubrwguguurrbrguwrrggwwwgburgrrrwbgwwbbrwrwrwgwub
uruwwwbgbbbbggbbbbuwwgubburwwuugburguurwur
gwurgwwwrgrurgbbrrrwrbggbgrwgbrgugruruuwwgrgwwwwrwuwubugbu
rugguwwgwrruurwbgwuguuruuuwbgbgubbubrrrbgwbwwwwbbbb
wbbwgwrgbwwburuurgrugbwggrwbgrgubbrbwurggbggbwwwrgggbr
ugrrurbugbwwrguugwugggrrugwgururwbbubgbrwrwur
rugbrrbwbbrrwbrgwuwbgugggruuubburgbrbububrrbubwuurub
wgurrbuugubgwwbruubrrwbwwubbgrububguwgbrrwwuwuwuuw
ubrruwbuguurgbbrrrwuggbggwbrrgwgubgwbruugwuuurgubrbwugwwb
wuwrrbuwuwbburgwurwggwugggbgrwrwgburgurgbg
uwwburubuwrrubbuwgwbugwrwbgugwgbbggwbugbwuwwbruggwur
bgrubrbwruwuuuwwrgrwubrggbbgbuubbgugubrrburbgu
bgrgrgbugrurwburwbbrruwrwbburwbwbggguwburrrwuggurbbrbgrbu
bguwuggrguwbrgruuuguwwgrbgrwbuugwrbrbgburwbwwbwrb
wggbwwbwwwbbggggurbbwuubgrbrgbbrrwuuwburrugwwubgru
rbgburuuggwwwguwwrbrggbrwuwgbrgbrwwbgrugwuubguwbu
gbrbuububuububrbgrgwurbbwbuugwbrwrururgugwgbwwgggbbgbwurgwur
ruurwgwggwbbwrbgrrurguwgwwrurgrgggrgguubgguwuwrw
uwbubgwguuubbbgbrrgwwrbbrururwgurrgbbrbgubwwgbgwuguuwurub
wrwrugugguwbuwwwwgrwrbgrbwuwburbbwwgubugwuguwuwwur
urbrbwwuggwurgwbrrbgrbwrbugbugbbbwuuguwrrwurrwur
rbrbubrrruggbrrwrwbruwburrwuwgwrrwgubbgguug
gubrurwwgwwuwbrrgurggrgbwwrrgbbruurgbuubrwgr
bbrwuugubuugwwwwgbrgubbbrgbrrguwrggrurrwgbrggbugbbwwbwrrgu
uugbbwwwgwgurgggrugubgbrwwrwrwrrurugrwwur
guwgwbwgrbwbrrwrbugbbwuugwbbwgwwbrwrwubbbrb
bbbrurugrugbwuguuwwrgbrbwbwwuwwbrwbrwurgbgbggrgruuuru
ubuubgbgbuwugugurbbwuubrrgbwwubuggwbururggrrrgr
ubgwwbgurbruggwwrubwggubbuubggbggbwwwwwwgubwgu
gburuwbbrrrbwwbgbugugguugbbbwbubbguwrbrgbbgwgburrugr
gbgwbgruwrgwrrurwuugrwugruwrgubwbrrbugubugugbbwu
burbubrgbwgrwwrwbbrbuururggwbwubugrwruruuwbuuggrwbgb
bbbwgubrburwbubwwbruubguugrgwrgguuruubbwbb
guwggggrgrrugrbbrwururugbbrwrurwgbwgrrrguwwrrbbbwuwuug
bgwrrrgwruwrbbuwgbrugruugwrrrugwwuubbugubbubgggubrrrwwg
bbgbrwrwrbwbbrgwwgbugugugrrbwbbbbrbgguwrbugrbwgwrbru
rrbwwggrgwurbuwbwbggbrrbggurugwgubgggbrrbwwrugrwgurbugur
ggburugbwruugbburgrbugrgrwbbwbruubgubgbgubugubbbgrrbrgrg
rwuwrgbwgwubwubrrbgbrrbwrrwgugwgguubbrbbwguwwwwur
wuwwgbbbwrgwrrbrrgwbwwubbwrwrrrwwuuburuubwbuubuwwbbgg
wbbgwrgbrbubwggbuwwuwwggrugwwrugrgwuubbwuugrggbbrgubwrrgu
burrbwgrgbrgrruugwbwruugwbbbburwbbuwgrwuguwrbgwur
bbwbwuwwwbwbrgwwwrrwggbwgruurrbrgwggbrbbbrrbgbbgrrrwrugg
wwwbbgwgbwwrbugurgugrrggbuguugrbbgwrguugggbwwugrugu
gurbrggwrwugwgrggrbrgwugbrbuugrwurrwgrbwurwuuruwuggwruwr
guuwgguwwubrbwwguubugurbwbrrwwwbbwgggrwururgg
wubuuuurbuwbrrrurbggbgrwbbwrbuwwbwwbrbrggrwgggwwwur
wgwrwugbrwgubguguuugwbubuwbbrwgbbgrgubrruuuuuuu
wbrgwggwruuwruwwrbruubuwgwwwbuuugbwububbgwbgwbgbg
wwwwgwwwugrwgrgrgwbbuwgbgruwugrrwuugbrbrurrrguubwwur
bgbubwrwwrgrwrbuwgurrguwbruuwgguwrurwrurrwgugggbwrbwwggw
rwwurgwuwgbbwggwwuurbwbbwrwrbwbrwrgbrbbrwbr
wrugbbrgbbugrrwbrwgwuggrbrwwwgbgbbuuurwuwubbggubbg
grrwurgburgruuurgrbuurgwgwurubgbbubbubuwwwbwbuuubbbrrwur
uguuguurrwbbwgwrwgruubgguubgwggbburbuwwgbrwruururwbgrgrrgu
gugbrwwwbguggrubbuwbbbwggbgurruruwubrwggruurwbggrrruurwbb
grgrbwuurwwwuwuwwwgbuubwbuuruwwwgguubwbruggbrgub
gwruurrugubbwbbwrggrgurbwuugbgbgbubbugbgugbwbwuu
wuubwrgrruwwrurwgwwurbugrgbrbuggbuwwbwrrrbrwr
urwbwrrbbgbbwwuwbwubrbruwgubruuuguguwubguwugurubr
rrwbbrwrbbuwbwrwwwrrguwrbgrwbubwuurugurgbwrru
wwrbgbubrrruubrggbrrgugbwuwgrbgbburbbgwur
gwuwggbbrbgbbgubgbwburbguuggugrrwrbubruuurggwrw
rurruwgrrrurwwwbbuuuwbrbrbrugrgwgrrrwbbgrgwguguubg
bwgwrwggwggrwbwbbrbbbrgrwbbuubrugbwbrbwggbwb
bwwwbugwbgubgrruwrbubggwurwwuuggbrugrrururggrbwbbggbrwgug
uugwuuggrrbgugbwuubwwugwruubbbrrwbwgbbruuggggwuurgrw
bwrururgwugwrwuwbbrgwgugrurwgrwbwwwwrbgwur
ugrrrurbggwwugubwrggwgrggrrbuggrurbbbrrugwurubbbguruwbuwb
uwbgubgrrwrbgrgurubgrurrrguwbbuurbuwbgwbgruwrggwur
rwurbubbwububgbbubbugubrbbuuwwwuuuruwwrwruwwbwbwwgwbrggbg
bwgrguuruwwbwrbubwrbbbbuburwwugwbwurggwguurguguurww
wwruuguwbgurrgwrubbbwurgubguuuwrwgwugwgrrwwwrgurrurrbgrbrwur
grurwwuwwububrrggbwrgrgbuggrwrbruubwbggggrbbwrwbwwrugr
brbuguuwuubuuwurrrburrgbbuwgwbwwwrrgwrwwuwuwbguurbrr
wgrbuurrbubrrgbgbbbbbrrwrurrwgbgwbrrrwrbubruubuubwrbbbwwur
wruuuggbrburwrbbwrwbwrbwrbrurbbgggggguuwgbbgrguggwruuuww
bgubgggbruwwrggrwubbbgbrbbrwrgbruugwruggguwwur
bbgrbgruburguuwwruubrbbbwwrrrgugbgururgbgwggrbwrwur
ubwubwwubbuurwuuruwrgwwwwwbbwgwrggbwrwbbubwgubbuwru
bbuguuwuuwururbgubrruruguwwwugwruwbwgwrwbgwur
wuwrugbugwbubwwwrrugbbrruwgwgruuugbgrurbwwrwg
ubgwwwwgrbbrrgwwwbugrubwwwrurbbgbbwrbbgubwbruurbuurwr
gguggugrbwrwuubgrurbgbgrgugbgrurbuwguburbuwbrwbrwgubgu
uubgrwbgwuurrwwuubwburbruwgrrrgubuwwwwrgwu
wwrbwwwgubgubrguugrwbubwgrbuuurrgrwruwbgubwuuwuwggwububrgwur
brgrgwbgrbbbgwgbugwwubgruruubgguuwrwuwwrwbbbgbururw
rrgwguwuuubrurwwwrrugbwugrubrrwurrbrrrbggrb
ugwgwbbbrggbwugbrrbruuubrggwugruguugugwbggwrgrw
wurbrrgbbwwrwgwwgugwwbbbgbwwbrwbbggrgbggbwru
ubwwwrurbubbwbggbbwrwbrrwgwwubguggwwggbggwur
bgwgwwuurwgbbrugrgrgubrguwwrugwwwgrbuuwbrbwbrwgwwwbwurwg
wrrbubuuguruwrbggbugbgwwruuwgbwubwbruwgbwwwwrguwbwwur
urrrrbugwrwrurgubrwubbrrwbrgwuururbuwrgrggugrw
gggubrggugbbbwbwgrgwwruwwwbuwbuwgggbbbgwubuguuurwbgu
uruuruugbrggruwbuguwbggbrgwbbburuwbwwuwrgbw
bwwuwgrggrgrurwwbbbbgwwuwbwwrwwbggrrguugbgruuuubwuwugu
gwbububrubrgwubrbwrwgwubrgrwrwbrrubggwbgbuuwrwubrwwwrggg
wbggbrrbrggbuwwwbrurbbgrbuuuwrrbuguruwurwgr
brubbuwubbbwgbgrwuggbgggbrbbguuwuuwrgubbrugbbbgugrrwur
gruuubwuggbbggugrbbgbwrwgwwgwgwuwwbruuugbugrrru
wwbwwuwrguubrwugrbrgggbwuwwgbrbwguurbrbwguuwwrbgwwubwwuwbu
grrbgrwwwugbwbguwgrgrrbubgwrwwgrggwuwuwrgggbugrbugg
wuuwgbggburgggrgubbrugbgrbruubruwguuggwwuwbgggwuwwgu
wurubwgrgurrgbgrgbbwbgggwwuwbbgbrruugggruguggbwruwru
gbrugrbuwrgwrrurrrurrwuwgwgbbgwrwgugwbwrbbwrrbrrub
ugbwrugbruwwurwwrwgbuwrgrrgwrugbruggrrbwbuwbburwur
guuuwuwbuurggburbbuugwgwrgguugrguguubbbbuug
rrgubrbbwuggurbrrgrbbbwwwrgrrbgwgubruwguruurwgwgbwgbrwur
wuggruwburuwbubuwuwbwwrrwrbwgwwubuwrugbggwgbwbuuwg
wwrrbwgubbrrwuwbggrwwrbubbuggwrrwwrrgugurguurwrrwbbwgbw
grggruubbgubugwgugbwgbuuwugrwwrrwrggwurwuguuurgrwuwrbwrwwr
wrguwwubrgrgbuuurggwubbwgwubgbgrrburbgwururbbgwrburr
gwbgguuwwgrbbbrwbuwgrrgwubwgurbwrruwrggbugrwwwur
wrbrwrgrurrugwuggbbrrurburubwrrbuugubrrrrbugwrrwgbuwrgbbr
rbuggurgwgwwuuwuuwubbbrguugbubrurwrrwuuwugubwugrugbrrwur
brgwburbwbrbrwgwruwwggbbgrwrbguguugugubgrgwgwwr
wrbbbrwgwbrgggrrwbwgbbwbrggrwrburrbgbgrbbuugwg
uggbwubwrwwbrgrwwruuwwrggbwrbuwurwgurgbuguwuugbwbg
brgwbgbuggbbgrguggbwggrgrwrubururuwubrgwwbbgwrwugwugwr
buruuuuwgugwbgbrwrbururbrurwwbburuurbwuuugbbbwwuwrugugbrg
rrgrrrgwggguuwugrwwguubbbuggrwrbruuuguwgwg
ugbgruuwruwbwbgrgggbwugbwbbwurugwgwuurbuwrg
bwuwugbbubggwwrwubuubwgrrbrrbugrurubrrguwrbr
rguwwugwruwrgbwwgbgugrwubrwrbbwwrbggubugubwgwrbrwuuubu
wgbwggggrgrgrbgurwbuugwuwwrbwbbbugruwgubwwgrrgwur
ugrgwgguuuwbrgrgrugbruwrbbbrguwuurgurgugurrgbubuwgubuwbwu
ggwwwbgwgwguwrrruwuubwgbrubgruuurrrubuurrrgbguurw
grwrwuubrwwurbwgbggwrwuuruwguuurrgbwguwubwbuurgwbgugwuwbwr
bbwuuwrrwgrrbgrgbruurguuubuwrwguwuwbbggwrubbug
rrbbruwbbrbbrbbbwbubbgwurrbubrrbrrubbwugubr
burrubrururbguwwgrubwwbgwugrrwgbbgwgrwbubgurgug
wuwubwwburgugwwbgwurbbwwgrwguguwwbgwggubgbwbbrgrurrbbr
buruwbrugwrwbrgruurbrwbbrggbwgugwbuwgrgbwwwruugrggrg
wrgurwwgwwrbrubuwrbrruurrbbgggwuwgugwwurbwgurgwbbbrwr
buubbgbrrbwgwwwbgwrubwrugruurgggwrbugubrgwrrgbu
bwrbbuguugbgurbruwgbbruuwubwbggbrbrbugggubbbwwwbbguggwwgrg
burggrbrgwrwbwwbrbuwuguwwwwbrbbrbrbbwwur
uwbrggwrbwuruubggbwuurubrrbwubrwwgugwruwgugguu
grbgggbwbbwwuwbrggrurwwgbrruwgbwgbruwwruwubrruwwbbwuuw
wbrrgrrguwbuuugbrrrgggurbrwbwwgwrwbrurwggubbuwuwgwgwbbbbb
brbgubgrwrbbuwwwbwrguwwwuggurrubrugruwrguuwwubgru
rrbbrguwrrugwuubrwgwwrubrubuwbuwbrgwbrwuruuguwuuwrgrgur
rgwrbggrbwuwwwggrggrgrwwgwgrbbgrubuwugbrrwrbgwb
wwwugwuggbgwwrrbuwwrrwuuguggbgbwwrrbggwrbwwguur
ugugbrwrgwbrrrbbrwrrrbuugubrwgwrrgugwbwgbguuwwwruguwgrwg
gwgrbgguuurbwbwbwuuguubgbrgrrguwrbubgwwrug
gubwwbrwrruwbwwrwwwbrgwbugrrbuwubruuwbrwbbwubrw
uggwgbwrguwwubbugbgrwurgubggugwwwwbwuburwgub
uwrrgwrrrwrwbgwruuugbwbgwggwrrrwwgurrrrrgurwwwgruruwgw
urrubgggbbwgbbrbrbwrrwgrwwgrggwbbbrrurgrrurgubwbwu
grurubrburbbwwuuwrubbbbwrwbbwrgwrbggwgguwuuwwur
bwbbwbrgrbwrwbbwugrugurruruububburwuwgugguwrwur
rbrrbgubwbgwuwuuwwwrubgggwwuuugggubbrrbbggwrwb
gbwrugrgubwbrwwurbbgwgrrbuubrrubuwubguuuwgu
bggbwuuubgwrgwuwbbuguwrburrrurbbubrgwrwrwgrg
wgurrrrbbggwbbruwbwbrbguuubwwrbuurbrurrurwur
gwbgbgwbruuruwuurrrrurrwbgrbbwguwgbgrwgrrwuwwwgbbrr
rubburrrwggbwuwrbggrubrgurgwbgwbwurgbgwrbgwg
uubuwbubrggrwwwuurgburbuguuugrbguuwugubwbgwrgrggu
uwurgbguubbuuwrubbgubggurrgrrbbrrrwwugwruwr
uwwgwugguugrugbubbrwwgubwubbwrwguwbwguwggrgugrwguggubrwb
bgrbggwgbbgrggwwrbbubwwugbwgrurrurbuuurbrbburbruur
rubwrbrrwwgwuwbbbubrguggwwbuwrrguwbwrgggwburbwuurwb
rrgbbwwwbwbubwbwrugbugguwbuwrubuwrubbgwbgwgwrbgurrurruu
gbuwwwwgrguwgwbgrugrrwbwuuguubgrbbugbbgrgbrgbb
rwrwbgruwbrbgbrbgwwrbwubbwwuwbrbbbburuwrugggr
buubbrbubwwuggurrwwuguuuwbrbwbrgggrubwbbrgbwurugrwgrrwwgb
rrgbuwbwuuwwwbwuugrurggwbrbwwuruwwwuruwur
grrbrwwbguwbbggguuwwugugrugrgwwwbrgrgbguggwrr
rbgrwugbgggbubugwrburgggrbwbrruuuubrrrguugruwwrbgrbwg
urgrbrrrgwuwwgguwuwuuubwwrugwrgbwrbuwuwbgwbwurwwwrgbrrggb
rgrwwwwwugbgugbugrgbuwrgwrwgburuwrrgrbwbuubwguwwwugbrg
wbbbggwwuuwwgwwuguuuwuwwugrwwwubgugurrrugubwgw
brbuwwwgwgurwgbwrrbrgruguwgbrbwububbrgrbuwrugrwwur
uubuuggbguurwbrwgrburbbbwburubgurguugbbruruur
grrrwbuwuwruwgbwwwgbbgwbbguwbwurrugwwbuwbuuurrurwur
ruruwrwuuwbrgbugwwgwgbrbwwrrrwrbrburrgruwrwwbbbugubwwgrbww
bgwruugguuwuurbubgwgrgruwbuwwwwguwwwrbgrwrurwbggrguw
wuwwwwuuburggurgwrgruuwggbguurwbggrwbuugrwbggurbgrgb
rugwbbuwrgruubgggwuwwrggbgwwbuubrguwugbburrbgrrbwrru
gubgwgwuubwuubrbrbbwwbwrbguruuurgrgrggurbuguwbgr
ubbwgruubgbuwuurrguwrbuwwgubbrgwrruggurbuguwrbrbbwgur
wgggurbbwuubrbwrgwuurrbwgwburrwrbuuwbwurwur
gwgbwwrubwugbrgrwbgwbgruwugbwubbbbbwubbubg
ugubrbguubwgbgwugbwgwrrgruugbbbbruwugwrurugrgrwwrbw
urgurgubwuugbgbgurbbrrgggggwuwgrwbwgbubwuruuwbub
rrrruwwgwgubwbubbggrbruuururugbwwgwwugwgggwguggg
uggbbuubrurwubuuwrurrbwwuuwubrbgwrbrrrrwbrbgwggwuruur
rbbbwbgrurugbbwguurrugubrbgbgggrbuguwrgwwbgrrw
wrgwrugruwbgrwbgbbguwgubwwbugubrgbrgwgburguubbbbuwrwwur
rwbuurbrbgrgrgbgbbbrgbrrgggrbbrgrruuubrguubbrgrwwwwuwrubgr
bubwrwwbrruwrbuuugggrrrruuwrbwwbggwrwbuuguwwbgurgbu
uwwrwwgbbwrugruuuuruuwuwgrwbwrbgubwwrbbwgbgbgwg
buuwrguuuurguwbrbrrwguubrrubgggwwrbbwgbgrr
uuwwgwuwgbgwruwuuubrrbwuwrrurrwbgwbuwbwurwur
ubgurwwbwgwruurwwubrwuwrbugggruurwugurruwguwgbrgrugr
uguuguwubgrgbrbgbwgwuwwwubbwrgrbuguuugrwur
rrwbrrrbuwwgwgrggwrwbrrubwrbrrbbwubrrwwur
ubugrwwbbrgugburbgrrwwwuugbwrugbgurgrwrgubur
bgwbgguwrgwruwgwwrwrugurrugbrggubwbbgwwwwrbwwrugggbrwggrrw
wurrguggggwgbuwwguwbbbbgwburwwbrrwrrgwur
gbrwwgrguuwwrrgugubwbgwuuugwgrwbbwrwbgurugruurwuuubrwur
rrrwugwrrwwruwbggwrruuwgrbuwbbgbbggruwwbgruwggburwg
brbwwggbgwwbgruwubbbbggwwubrgubbuwububuwurwbbwwbwu
gbbggrbwwuuwuugrwuugwbrurrruububggwrwggrgurwwur
rgbwwrruugbgruruwuburgrwrwbbuwgrggguugugurwggwggrgugggrg
brbbwrruuubuwurrrwburbrbwgwurrbrgbrwrbgguruuwuuurbgbbg
gwbrwbguugbbwrgrgrbgbruwgwruwbrwugrrgbwwgb
wuurgwugrugguwwwbwwubwuubgwubuuubrwuuububrugwbgggrruggrrr
rggbuwwggruugruwugggrgrbwbwrggrgugwubrrgrwgwrwuru
uguguwwwgugrgbrwgbubwwuurbgguwubrrugrruruwrgrwwubgwg
gbbbrwurrubrugwrgwrbugwggugrwuubuwbgrurbuwbgbbbgw
wrgwuwbwrbbrgrbwbrbuggbuwbrgurwggwbbgrwwuwbbgwrrrgrubbb
bbubbrgwrgbbbrgguurggrurwuwubgwuwubburbgwrgw
urggrwbgbggrwbwburbbubggbrgbgwbrururrgwgbbuwbu
urggbbbrbubbwubbbbrbgubrwrrwbuwbbbbrguwrubbuwuwgg
ugugbubbugggwwbbruggwwrugbrurguugbrwbgwuuwbbwuguggb
wrbwrrbgrurbuwwrwwwrrrbrbuuwbuwbggwgggwuuwwuwbrwwrwbrrrrrwur
ggubgbruuuwbgrubwbbubgruwwwuurbrwbgwrrwbrbrgu
bwbbrgwgburwwbgrrwgbururwrwggguwgbwwbgwuuggwuggrbg
ugwwgugbuwruuggugggwrbuguuugggwbrwrbubguuuubwbwgwg
buugrgrruurbbrbgguubgbgbbuuuwuwgwbrrgwur
gwbbguuwwbburguugubrwgwwwubbubrgwruurwwruruwu
guuwbugrurwbbugrbrwuwbgwbrgruruwugwwbrrgrwgrwrugggbwwur
grurbgrrubwwwbwrrurwbwbgurwuwgwruwwwurwrwwrrugw
bwgbuwurrugwwrurbrurwgwubrrrrbuwwbruuggwbrubbrgur
ugwuwgrubrrgbbrwwgwggbwubgrbrbwwbgwbgrbuwuwwrrwg
ubbuwubugwwrgwrrwwubguurgbgwrbubwwbrwrwbbburuuruuurbuubu
wrbrgwubgrruuwbgguwbubwbbggrbgwbwrgwwrrgrgrbgbugubwg
wrugubgwbruwgrgrbgrugggwwwrwrwuwbururgrwrggwwrubuwbbbggbu
wugubugbbrrwwwrguburwrguwrugubwgugrbbguwrgwwwbgggubrrwgbgwur
rwrbgwguwurbrrbbbrrwrugrbggggwruubwruwbgbwrrrwbg
brrgrrugggggwgurgububrgbuuwgubugbgbgbuggwbburbgugugbw
gbbugurwwrbrbwbwwgbbrrruuwbubwwwgrbubuwgrw
wgubburbrubrwwugugwrburrbgurbgbruuurwgubgwb
ubwubwbgwrgwwuwbugbrwgbgrwgrwuwbrbububguguwrgwrwwwur
uwgwrwguwrbrgguwbgubrbwrurrwubbwbggbwbbbwburrruwbruugu
bwbwwbrwwwuwrrbugrgrrbwwgrugurwuubwbwgguwgbwwgwuwrbrb
wurrwgubuuwrrbbbuggwbwugrbgwwbrurwwuwwuruur
wgggrgrurbbbrbuurubgububwuwrgbbuuugbwwwbgurbruwbugubr
rurrubrwrwubrgurbbbgwrrbubwggbwwbbwgguugwrwwubuw
wwuggububbrrbbwrbwrwburwbrgwwgwugguwgrbwuwbuurrwwugbwr
ggrwbrwrbwwbwwwbgbgbbgwurrbwwbgubwbgrgubugr
rbbbbgrggurwuguurugugrruugwrwgrwgrbwbbwgrbrurggr
wrubwggwbuwrbggwbuwggwbwgwrruguwrbubrggbrwur
gwgbwrwugbwuwubwwwgrbrrbwubbwbwrubbbrwuuuwuw
bgwgubbuuugurwrbubrurburggwbrguwbggbgbbbbg
gwurgbbburbrrubgwwruwrwugbwwwwruuggwgguwuuuwuuurubgru
bgrwbuugwwrgggrggwrgrbbggrgbwrrwubwububurrrbgwggg
bbwuwrurwgbrrurguggrgwgggwuurbrrrurguwurrwgwruwbbgb
guwugbwrwwbgrrrugwuwurubwbwurgbwubwubbrwgwugb
uwrurbgwubuwruuggburburggwguwwbwgggwgbrgrwwrrrgww
ggwwbgrbuwrruurugggwrbwwgrgrwburgrwwwwrwbrbrrwrgurggrgwur
wurbwgrugbwugrbugbrrwugruwrgubuuwuwgrgbwgggb
wwuubuuuwrguuwwugbuwuububwubbguubgbubgrrbugbrgrwrbwrb
wwbrbwgbggbuubrwwgrguubbrbbwbbuwurbggubrrrrw
ggrugurgbwggwwwrwwbbgbuubuuubbwrurbubwbgbrwur
wgbrwgurwwgbbwwurugwgwugrggwurgrgbbbbrrbrbrgwuur
urwrbrgrwgwuurgubugbburugbgbguwbubgbwugbuubu
bwgwwuugrrrgrbwbggwuuwwurugbwbwgubgbwrubwgrw
brurrbbgubrrrurwwwwbubbgwgwgrugubbggwbggwubuuug
uwbwgrubgbbgrrrrubrgrgrbrbgurrbrgwrrbwgrwrgrgwgrrubbuuwu
wgbbrwurubuuwgruwgubrwwwubgbggrburruggbbrrwwruwwwwur
uwurruwrugbgbwrrbgwrwuwwuubruwrubrwwbwrwgggwugbrrrrwur
bbuggwgbbruurubuuwgbbwbrbrrbggggrrbuubrububbubugu
brbguwururwguwbrgrrwbbbwbgrgbgwgwgwgrrggrwrbbrburrur
gwbbrrwwrggwrrgwwrwwwurrggbuugubbrwbbggwur
rgguburbuggbbbrgurrwrwrggbrgrbuwbrgwwbwrurbugbbbu
buwuwwbuwugrrgrwuugbrgwurwwgguwgbggrrurbwgrurrwur
uugubgwggruuuggwgrbuwbrbuuwbgugwbuugwbgbgwuuuwgruwu
rwwubbrgwbuwbbguugwgbwburrwubruubbuwwwwwgbbbbruwuuurwur
rrrrwwguwgrurbubgbrgbrurwwgubwuuwuwbbwruwwur
bbubuubgbwgbruwugggurrwguggbwbbbbbgrbwggubwgwubgbwrwur
bubgwubbwrrbbwgurwrubrrubgurwwgrubbbugrgub
rbwgrbubbubwwrbgbgbwgrbubguurwwgguwgubbrrbubwr
guugbrgwbubububrbrwurrgwurbwrggbgbrbwwrbbuggugwgubrwrwbbbb
grrbguguwwwuwurruubggguububgwurbubrrurwrwguggbrwrwgugb
rgbgbugubuwrbbrwwuwubbububgwbugwurruwrbrgwg
bwbwgubgwbwwurrubgbrgurugugwwrwrrbwwbbwggrb
uuwwrgrurgbwgruuuubbugrrwbwgrbggwbubwbwbwgwuubugbrwur
bbwrbrwrrrrwwbbguwrbruwgbbrwurwrwuugbwgugurwwugrrurgugubu
urgwrrgrgggrguggbgrbggwuuburbwrwgwgrgbwrgg
ruuuwrwubrwwuguurrwgbrbbgggrrrgrbuwuuwwrrguu
grwwrrrrggbuwurwbugugugrrwwuwwgggrbrwwrbwuwbwgw
rrwbbruwuwwwuggwrwbrgwwgggrbrrgwrbgbwbbrwrbubgrrggwrwgrg
uwwwbwwuurrguuwwubwrbbuubbwwgrbwwbbwwwurwbuuwrwrwggwur
grrgwbgubwrbubrwubguburrggbbugwwwwruuwwuggbg
grbwwuwubbgggwbbuggrgwburwwrruruugrgwwwgwwwrgrbuwbrgb
ggrggrrgbgggrrgrbrurwgbgrrwbgruwwbbggbgwwbubwrggwgr
wgrubwrwbbrgbwuurwbwwuubwgbuubbwrugugurbgwrbwrbuwgguurww
rbwbwbgwuubrrrgrrubbbbburbbwuwwubbbguubgwwwur
buuuwrwwbuuguurwwbuwwgrgrgrrrugwrggbggwbgubw
wwuwwwwbrrwbwgwuuwwwgwguwgwubuwwgwuggrbwbrr
gbbgbwbbrbrgwrwburbrbwrburrgwwuguruubrgubgrgrwugb
urbgbwwrrwguurugruurbuwbruwrguuburguwwuuruwbggbwuwggb
bwrwwuurugugggwuuwrbrgbuugbuwbuubrgrrrrbwgbgwgbu
ubwrugrgrwruwggbwruuggbubwguguubwrrbggbgwggrww
uwbubuuwbgbuwbguwuwwgbggugwwubrbubgbuwrrbuwbuwrwbubgbrgru
bbruurgrwuwbrgruruwwuwbwuugwurbbrwgugrrrurbubgrgw
wbgwwrrwgwrugwurgbggbgwwgbwrbrbwwrrwugwrwbuuugguww

98
2024/day19/main.go Normal file
View File

@ -0,0 +1,98 @@
package main
import (
"fmt"
"strings"
h "git.bullercodeworks.com/brian/adventofcode/helpers"
)
var cache map[string]int
func main() {
inp := h.StdinToStringSlice()
cache = make(map[string]int)
part1(inp)
fmt.Println()
part2(inp)
}
func part1(inp []string) {
available, want := parseTowels(inp)
fmt.Println("# Part 1")
var possible int
for i := range want {
if build(want[i], available) > 0 {
possible++
}
}
fmt.Println("Possible Designs:", possible)
}
func part2(inp []string) {
available, want := parseTowels(inp)
fmt.Println("# Part 2")
var possible int
for i := range want {
possible += build(want[i], available)
}
fmt.Println("Possible Designs:", possible)
}
func build(towel string, from []string) int {
if _, ok := cache[towel]; !ok {
if len(towel) == 0 {
return 1
}
res := 0
for _, p := range from {
if strings.HasPrefix(towel, p) {
res += build(towel[len(p):], from)
}
}
cache[towel] = res
}
return cache[towel]
}
/* Slow solution...
func build(towel string, from []string) bool {
if len(towel) == 0 {
return true
}
for i := range from {
if len(from[i]) > len(towel) {
continue
}
var nextFrom bool
for j := 0; j < len(from[i]); j++ {
if towel[j] != from[i][j] {
nextFrom = true
break
}
}
// This 'from' didn't match
if nextFrom {
continue
}
if build(towel[len(from[i]):], from) {
return true
}
}
return false
}
*/
func parseTowels(inp []string) ([]string, []string) {
var available, want []string
pts := strings.Split(inp[0], ", ")
for i := range pts {
p := strings.TrimSpace(pts[i])
available = append(available, p)
}
for _, n := range inp[2:] {
want = append(want, n)
}
return available, want
}

10
2024/day19/testinput Normal file
View File

@ -0,0 +1,10 @@
r, wr, b, g, bwu, rb, gb, br
brwrr
bggr
gbbr
rrbgbr
ubwu
bwurrg
brgr
bbrgwb

View File

@ -38,6 +38,7 @@ getproblem() {
DIRDY=$DY
fi
if [[ ! -d "$AOCROOT/$YR/day$DY" ]]; then
echo "Making directory: $AOCROOT/$YR/day$DY"
mkdir "$AOCROOT/$YR/day$DY"
fi
cd "$AOCROOT/$YR/day$DY"
@ -70,7 +71,8 @@ getinput() {
DY=${DY/day/}
fi
if [[ ! -d "$AOCROOT/$YR/day$DIRDY" ]]; then
mkdir "$AOCROOT/$YR/day$DIRDY"
echo "Making directory: $AOCROOT/$YR/day$DY"
mkdir "$AOCROOT/$YR/day$DY"
fi
cd "$AOCROOT/$YR/day$DIRDY"
if [[ -f "input" ]]; then