advent2024

Advent of Code 2024
git clone git://bsandro.tech/advent2024
Log | Files | Refs

commit 812dec89007d8d76f83ff97c88009629a9ff05dc
parent cbc677f8e10ebdb7017d10d5cddcc76dd010bf7e
Author: bsandro <email@bsandro.tech>
Date:   Thu, 19 Dec 2024 22:45:24 +0200

Day 19 p1

Diffstat:
Aday19/Makefile | 28++++++++++++++++++++++++++++
Aday19/input.txt | 402+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aday19/main.cpp | 94+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aday19/test1.txt | 10++++++++++
4 files changed, 534 insertions(+), 0 deletions(-)

diff --git a/day19/Makefile b/day19/Makefile @@ -0,0 +1,28 @@ +NAME=$(shell basename ${PWD}) +SRC=$(wildcard *.cpp) +DEPS:=$(wildcard *.hpp) +OBJ:=$(SRC:.cpp=.o) +CXXFLAGS=-O2 -std=c++23 -Werror -Wall -Wextra -I. -I../include +LDFLAGS=-lstdc++ + +all: $(NAME) + +.PHONY: clean run + +clean: + rm -f $(OBJ) $(NAME) + +%.o : %.c $(DEPS) + @$(CC) $(CFLAGS) -c $< -o $@ + +$(NAME): $(OBJ) + @$(CC) $(OBJ) -o $@ $(LDFLAGS) + +run: $(NAME) + @./$(NAME) input.txt + +test1: $(NAME) + @./$(NAME) test1.txt + +test2: $(NAME) + @./$(NAME) test2.txt diff --git a/day19/input.txt b/day19/input.txt @@ -0,0 +1,402 @@ +uurgw, burbgur, rwgbrg, ubburu, rgr, wug, bbwrg, gbbr, ugwuu, ugu, wwrgwwub, rwurr, uggg, rwb, bwwub, gbb, rbwuw, u, guwrr, wbgw, gbrwbwb, gbrgwu, ubrrwuru, wrwur, rru, uuwgbbug, bwu, bwgggrgb, brbgg, bbgr, wrugg, gbwb, rwuw, wuwb, gwb, rgwr, bwrug, wrrb, ubru, wgr, wuuwgb, wgbbrb, uubgr, rrw, bggwuu, wrgb, urr, urbg, rwggbg, wrw, ruwub, uub, rgwgrgb, bubwr, wrg, rrwrrrbw, gu, rgb, bbr, bgb, burrrbr, rbu, gbbg, rwrwuw, wwgw, ruuu, wru, rur, rrwg, ggrb, ggb, bbw, wgub, ww, uugw, ggbbrwr, ubbgwg, uwwubr, bgurbb, buwgbw, uw, bubr, wgubwr, guw, rr, ubr, uww, uwr, ru, bub, uggbubw, bb, rguwu, grbgw, wrgr, gbwwrb, gugg, rrggbrub, uuu, bwb, brb, wrrwr, brww, ruw, rgu, wbguwgu, gbrguww, gbg, buw, uwgr, bwru, bwg, wwwb, grgg, ubg, ugr, gg, rurrb, w, uugg, rbw, gurbbw, rugrrg, gbug, wwu, gwwgr, wrr, wgwrbr, guruw, urwgr, ugruw, rg, gwuw, ugrwubrb, bgwrw, rbur, wgw, brbrub, gwgwgu, rrurbwu, bgr, ugbwwuub, rgrrubuw, bwr, wrru, wrub, gwbu, wbbwgbr, uu, wbubb, bwurwbr, wb, uguwu, bbgb, wruu, ur, ggwb, uug, rwwuw, wuuubwr, ggu, gwwg, gw, rgrg, bggu, rbg, wbu, uwu, ggbbgg, rwgrr, urrw, ruu, bgg, gbrug, brwr, bg, gwwr, brgbw, uwg, wbrub, gbw, ggw, rwguw, gbbguwwg, bgrubu, gug, gb, gwu, bbuu, wbbr, wgg, ggggg, gbru, ugggrw, ggwu, rrr, wbgrg, ruugwb, wu, ruru, uwwgg, brbru, uwbbguw, ubuu, ubwbrg, uwwub, ugbubb, bgggw, rubwrrg, br, ub, ggr, wgwgr, ggbr, bru, gwg, gruw, rb, bgug, buugg, grgwgbg, bgu, wuur, gbuubg, rruwg, urbb, brw, wbgbbbg, rwu, wwr, gwr, wur, ubuw, gbgwbu, wg, wrb, rug, rbwwwgw, bbww, wwbbr, ugrb, bgub, brwgr, wgrbwrbb, gbrw, uubw, rguug, uubu, urw, rbbw, gur, wgb, rrbgr, ubruwu, rggr, rugbgu, urg, rwbww, ububwr, urggb, ruubu, rbgr, wgrrwbb, rbrb, uwwrur, ruwbgwb, wuwgr, gww, wuu, gwgwgr, bgwb, ggubgu, wuwwwub, ugb, uuwbrgr, bggbbwu, wwbwgruu, wbgubb, uuwgb, rbwg, rw, uwuugrr, wguwgb, wgu, wrgg, bwwr, brrwg, gurgu, ruwgu, wbb, gwgrrwrr, bwubbg, ugrguru, grr, bbg, ug, ubwruwu, brgbwrgu, ggbuwru, wuugwu, urwg, bubrwb, gbub, wgbw, ubrubbw, ruwwu, rbrgb, wbbrgg, ubugw, gurb, gub, wwrggrwr, wubgur, gwbww, wwwrwgr, wuw, ubbwwur, grw, wbr, wwg, buwgw, ugbug, brg, brubwbw, buubggg, ubu, urgbw, rwbubw, grg, bubu, gbugw, ubwbubb, uuguw, wrugr, uggb, wugu, rbrrg, bbb, rgw, urwwrb, gurggub, uwbb, uwgg, rbrgu, gbr, ruwur, wwrgu, wub, bgw, ubwb, rwg, urguw, brr, rwr, bwgrwbrb, wbwrbbrg, wwug, buur, wuwwr, rbb, gwug, grwrgub, uwrrbr, gwrw, ubw, ruuub, bgrrrwwu, rub, rgbr, ugw, rbrggr, ubb, gggr, brggrb, bbbw, gugguwb, rbwub, gr, rww, wbgb, uru, ggg, wbg, rgug, ugruugw, bww, urru, bubb, bwrg, guu, rrgrrg, gubrgg, rggwwrgb, bwgrbr, bbgbgg, wwrgw, uur, bgruwu, ruwbrrb, rrww, bbrwgb, brrw, www, rbr, grb, uwb, gru, wubgb, bgwug, uwgwg, ubgruw, g, rwuugr, brrb, uugggb, grrb, urb, uuw, urwgg, gwbr, gbu, ggrwgu, bwbbwgb, wbw, bgwbgb, r, buu, brrg, ggubg, grrgbur, bgbwbg, wgbb, bwburb, guuggu, rggrwrw, wrwrbwwg, wwrw, uugbr, wr, rrb, rwrww, urug, ggrgg, uurrr, bur, ugg, ruwbwg + +ggbgrrgrbwrbuwwgwgbwbbuwrubugurwbbwubbuwgrgurwwgrggbg +grbwbugrurrrwrwurguuubbubgwuugrwurwrbbbgrgu +bugwbgrrrburbwwgwbugguuggbwgrrwgbrbgbuwrgguwubwwbwwrrwrrgrur +ruubrbrbguwgguwurrubwbrwuwbrubwguggbgbrbwurrugrr +uubwbbugurbrrgwuwwguruurbwwrgurrubwwuugbuuuu +bugrbbrrugwrbwgwrbugwruugrwuwwrggrwrwugwguurgwrwgw +bugrrrgggugwwugwrbrurggbwwwbgruwrbubrubbwwbwwwubru +rgurbgwruwbugbgwbrbguwggbggbggwurgguwrgrgubwgwu +grwwubgwgubwrubwgrrbwwugrbbgbgbwurgwgrbbwrgburur +gurbrggubwrwwuurbwrbgrurgwwgubwwubwbbuuwbgbrgurbbbrug +gbuuruuuwbwwwwbrurugbbbwuurrurggwwbwgwbuwgbwruwbgu +ggwugbggwrwwrggrwrgwrwwruurbgbgwuuuurwgbbuwrwgbrug +bugbbwubrugbbrgbwrguurrbbgbuubwwbubuubwrww +ggubuuwuubbwgrwururwbgwrbbgwwgwrbbgwgrurwbgbrwbb +rwgurbbbgrrbwwuwrrbwbgbburuwuuurrrbguwrrrrwbbgggbb +ubgbugugwguwrbbuwgrrgbbrrbwuwrggggwuurwwwgurgbru +wuwugrgbgwgugrrwwurbuguuwggwuwbwwbgwbgrrbuwbr +wrrrwbwruggrwgubrbgubgguurwubuuwwgrwrrurbruuurrww +bugrbuwwggrrbuurrwbrggwrbrbbuwugbbrgurrgggwggurw +uwbbuwuwrwrbwwggbwbrubrwbbgggrrgbrgbwgrwwwubuguuubwuru +ugburwurugburuuwgugrbrbbbwuugwwrbuwgwugguugruugrgbgrguubwb +brggbuugwubggwbubbuurwrrggggrbbrgggrurwggwb +gggwuwrugrguugwgrguwgwwgguugbrurrwrbwuuwwr +bwrgrwrbguwgwbggwuwubgburgurgbgrbgrgwubbwgbruub +bugwgrrwrrrbguwgrwwrgurbruugguwwgbwgwrwrubwb +wrrubuurgrwrrgrubbgwgugbbbbgguggrwrbguwbgrguwrububwg +ururbwuuuguugubgwgurwwwbbguuubwbwbwwugrwbub +bugrbrugrgbwwgwwgwuubggugwuwbbwrwugurbubruwgbbggwur +ugbuwwbwuwbwbuuwgrbbrbuuuwwwuruggwgwgrwgbrug +ruurrgwbgwrwwurggurbgbuugwwubuwwwugbrurwgub +uggubbbwuruwbuuggbbggurbubbbburruruwuugrwuwbgrugggu +buggwbwgurbrbguwbuwgwgrbwuwruwwuwbwwubuugbuwb +gwugrgrwgwwrrrgrwrwrburwuwbbwbrgwbgwbrgguurbbru +ububwbuggrrgbwgbbrubrguuwgguurrugugbbuuubrbrbwbwbbbrgwb +wwwrwbgrwrwwrbugbburrgbuwuwrgrwubguugbwugwggrubwuggu +rgbrbuwuruuuwwugbggrrwgwbugbgwwwrgrgugwbugbrwwwbrrrgggwrrg +bugggwubbbbbgwugbrguuugbbgwuurgwgwbwbbuuu +bugwgwbbbubrrurrrugbrbugugrwrbgurwuwurgwuubuwbuuuru +ubwrguruwrrgbbuugruwgruwbrguurwgrurbuwuwrrrurwrwrgrbwbbu +gguwrbrrwwwggurwwubbgbwbwuggwubggrugbgubuwubrrugb +brrruwuuuruubgururwbrbwuwrgwrbuwurgruurwuubggww +rwuwruwurbgrrgubgruguwrwwwbugbbuuurruguuggu +rugrruggrwrbuubuuwbrbwrrggguugruwrbggbwbbuugbwuugugrbwwrb +bugwgrwrggbgwwruwwwwbrrbrurbruwuuwrubuwurbgrwgwugwguburwurb +bugbbbubrwburubugrggrrwgubuuubuuuuguwggbugguugbrbgurgwuu +rurwbgubgbwgrbwurrbburrurbrrbwgugwuuwuwrubu +rrrwbrwrruruurgwrggbuuubrbruubugbbwuubbgrggruw +bugwuuruuwbwbrwrgwurgwbgubuguwgbwrbwrubuwgwrwb +ubrrruurgwruwgwrbwggrurgbrbuuwrguurbrrbwwbbrbruwrgggbr +bugugwggwbrwbbrgugbwugwwgrgubwuwwrrwbrub +rwubgrgrbrggwugbbrbgbwwgrbwbwuwrgrgwwugrgwg +bwubugrubwugrbwwrwgbggwwgubwrwbrgrbggubuw +ruggwurbgubbbrugwrwubwrbwrrurbguwwgbgwwgwubbwur +urubwuwrguguwwrgwgurgwggbbbruwgbggububbrwbrgb +uwuwgbgbuwubbruwrgburugbrgbugrwurwgwrrrggbrubgguwrugrrgwww +wrbubbwgbgbrwbwbwbgwgrgurggwuwguubwbbwggwgwgwugrrwgwg +ugrbruubrgbgrwgugbgwbugugbrbubrwwuruuwguwrguguwguuwrg +bbguwgwwgubwbwrrwrbrubggruguwwbbrgrgggwgwrrugggwwguwurbugr +gurrggrbruwburruwrbbbbbggrrbwrurbbgbuwgrbbr +ubgrrbubruwbgrgrwwrggwbgrguwwbgburbuugbruurwbu +brgbwuuggbbwbwbwrrwburggbbgwwrwwwguubwwurwgrwuwggwgwrgbr +wgwuggrwwurrbrgwugrbrubrbgurrbbbwgugbwuugugw +bugbwrgbbwbgbuuurbbwrrrwbggrguggbgugurwrggwggrwwggbbrwgrb +brrbrbwbgrbwgggurbuwwgurbrbgwrwguwruwruwgbwwwrrwbugr +rbrrrruwbubgbwwbwgruurgggbbubbwgrgruburbwuwru +uwrrbgwugbggwrburrrbgbururuguwwwwgrrugurwgbbugubbb +rgwrbbbwbwuwbwrrwbbuubububrwbgwbrubgbbwubrgrbuwwbbwgur +uwguggwrggggggrburwwgurgwwgwrgggrurbwrurrr +wgggrwwgbubrurrbbgwrurbbgrwgwrbguuuwugwubruuwurbrggwg +buubugrrrgwbwgubrggrgbbrgwwrugwugugubwggwwgurgubbgu +grbbururwbwwburrwgrwbrgbrbrrruwrrwgbwbrugrbgwrwugggbru +uruubgrrwrwrrurbugwbuwwwwruuwuurbrwbbuwggrbrurwgb +wgbgwrwuwburgurrwuuwguwgurbbrwgruggggurgurguwbbuubug +wgwwbgwgbrwruburugburuwrbbrbuwwguwbbubruuuurgb +wbuugggrgruuguwbbrwrurgwrgbuwgggbbgrruwubbrbww +rwrgrbuwrwgwgwwrwwwbrbwrrruggwguwwgggbuurgrrwwrb +grugurwbwgbgrgbgguruubgbrugbbrbgbrggwgrbrbrru +gugrgwwgruwgugubwwggwwgwrugwurgbwurrbgbbbggw +buggwguwurbgwbbrrgggubbwwrrgrgbrrwwrggbgrbwruuw +gbubrwburbbwuwrbbbwbubwuwwburbgrgrgburrwrwgrwgwgbwbgwug +bugggbwbbuwbugrwgubrggwwwuwrrubwurbrbbgwurwwbbuuubruuuuguruu +brwugugwuggurbrugurgwwwbugbwbgruwgbruburrggww +gwuruururbuubwbrbrubwrbwuwbwgubgbwrggwgguwrbbbwgrbu +bugbbbruuwbrwbgbgrwruuuurgwrwuwwuruubbbrggrgbbguwwggbwwwu +rgugwrbuwbwrubbrwugbwwbbwgbrwwgubggggbrbugrrwbww +rbgbbwbuwbbruubwrgrwuuugbwrubwugwgbbrguwrbwgrbbugubg +bgwuggbrggbbbbrwrgrwuuuwbgbwbrwwwwbwrwrrgbwwgrbugwwub +brbuwwwgwgggrrburwwgbbgwwrwrgguubwwwbugguwrwbwwuguuurg +gggbwrwgbrbrwbrwgrbrbbbugrgbgbrbbwuwurbrburbw +rbbrrugwwwwgrgwbrgrrguwbubwubwururbwbuwgrwggurugrruwbug +grrubrgwuwugrbuwbgwuwrgwuwwwgrburrbuurwgggubguggbwrbrru +bugguguurgwrgggbuugurgugrrbgggbwwbwgwruggwubwgruggb +wwwbgrggbwggrubbwrububwrrurubrgbbbwrurgwguggw +bugruwwrrruggggugwbwwwburwrgwgggrrrgguuuuuwrubwbbuu +grbgguuwruwwbgwrwwbrubrbuuggugbuwuuwbwwubgrrrwbbbwb +bugurbbbwgruugburgggbgwugwgwuwrbbbrgrbgggwb +rbbbguuubrubgruubwgrwuuuwwbwrrugwburugbuwgubwg +bbuwgbugrrrguwgrugguwwbbwruuburwgbwwrbwbwburgrwggbrgrrw +wbwruruwgrubwrgwwgurbuwrbruwgrubgggrwguurwrbbwu +brwwrrbguwrbwwrgbuwbuwuubgbggurguwuguwbgguwrwwgubrrbgrrbw +bugbbrwbbgrgguuwbgrbgwwrubgwbbwrrwggurgbubbuwbwgwugg +wrbuuububbbrwwwwbgrgwuwugwbruugbggbbwgrgurwgruwwruwwgr +bgggrwrbwgubgurbrrwrrguugwwgwbuubwwrrgggbrwrbgbubgrwuru +buugrggbrbwgbggbbbgrrwwugburbbgbrrbrbuuwbuwwbwgrrwrubuwwgw +wurbuurwwbrbwburugggbwwugrrurrwrrwgrbruwrgruuw +guubuwwbbbuwrugbwwuubrbrgwgruwguggbrurrurrrwurr +gwubrgrbgbrwbgwuwwruugrbbbwurwuwwrbwrrwbruuwbr +urrugrrggurwgbgrbgruwrwwuruwwuubrwuurgubwugg +uwrwwbuuubrgugwbwuwgbggrurubbrrgwubrwbbrbrb +bugggbruwwgurrrgwwbrrgbrrbuwbugrbbugbwgrruwubuwwwbwrbrrbgbgg +bugbgrbguurugwwbruugbggbbwuwbrruuwbrrgwggwurwgur +ugwruwbwbwwgbrwbuubrrwgrruuguuwgbrburbwuubrbbwbuwr +uwuguugwbguwbwwugbrbwrrgbuwggrbwurgrwwbrbr +bugrubrugbgwwrrbrubrurgrgwurbruwrggbrwuwwurwrwuguu +urrugwbrwurburgwubuwwuwbbbguwgubrbugrruuwwruugbbwrb +bwuurbwuuubwubrwbugrwgruubwggubrrbwgwubrrrgbburrrwg +wwwrrgugburubbuwrbggwrwrrrrurwgwbuubrbrguuurrwurrwggrwrb +wgrrrbuuwrwwuwbguurburgbbgbruwbuuubwwbbrbgubbbwbubruuguw +gwwgbgwrrrgrrrwuwuuwubuwurrruuwwuwuwgrgrgwbuwgubgbgubuu +uuurrgurrwrrwrrwrgwgrbgugugbbwuwubbrwrubrgbwbgbuuwubbrwwb +bugwwgrbuwgbwbrubuuwuwrgrwgrwruggwwurwbwrw +rrgwubrrwbbgrbbubbbggbgbwuguwurgwwrguwuwburww +buwgbwbbwwggbrgbgguwwurrbwwwwgbburubwguwwrr +ubbubwgugbuugrugwrwuurgubrbrgbrwgrwwgrbwbwbbwurgubbbbbrgw +ubbgguwbgrurrrgbwrbwuguwgbbuuuwurrgubwgwuggu +gwgwggwrwbwggggggurrubwggggwwbwuugbggbwrrwug +rgwurbbbwuguugubruuuggrgwwuugrubruruwbgwgrbbw +rbwgwrgruruugbrrbbrbuwuugrwuguwrwuuugububwg +gwbuububugrguwbwgubwbubbrrrurwwurugwgbgurwrbguuwggrrrubbgb +rubrgurrbbbwgwbwrubbgbbuwrwruugrwbbgrrgwwwgwruur +grgrgbggwruubuguwuugugubgwgbwrbguggbwrrwrgbrubwwurgugb +rburbrbwbgrurrggrwggruuwgwbggbwwbgrbuubbgububgrwgrugwru +ubrrrwrggrugwgubrwgwggurwrbgrrwugrggrgrwwugubgruwubgr +bugwgubgurbgbgwrbubrgbguwgugwburbrurgwrrbwubwgbwrww +bugwugwbwuwwwurbwuurugwubwurgbbgggrgurbbwgrwwwwr +wguwrbwbuwubgugwuuwrwubgruugugbgbugbbwbrbuwbrgwr +uwrugubwbwwbwrburwrurugurbwwbrugwbgbugubgbrguwwrrruubub +urrbrwwwwwuubrggwbbbbuuwgwguugbwrrgbgwugbwgubr +wruguwuggrguwbgbgwbwgugrggbwgbbbuurrwwbuugwgbbguurubruu +rrwwwuugwubruwbwbrubguuwruugwuguubwbwurrrugruuugruw +wubugurwrgrurwgbbgbburgwbggurwguubbrbugurugrguuggg +bugrggurburggrwrbuubbubbgrwwgwgguwrubuugbrurrwbw +gggurugggggbuwgwguwgwgrwgbwbgurbwwrbugbwwuw +wrwurwubwgrgbgugrbwwburwguubbbgwburruggbwgwbwgrur +bgurgugrrwugggubwgwwwwggwrrbwbggrwurgubrrruwwbwbgugrubugu +wbuwwrwbgbgwrwbbbgrgwugrgguuurwgrbrrbbbwrrwrrugggbruwwb +urrwwuruwurgwugbuggrwbwugwbbbruwrgugrwwbrrbrrwwgrwwr +wbwwwrwuurrgrrgrguuubwwgugggguwbgbrrbgbbrwrbwuwruwggubrwr +buwrrwrrwrubwrwwgwrrugbbugbubbbuwrrbrgbubggrwgwgwruwbub +rgruwbrwbugrrbgrruugwrwbwwgguubrrrwrururwurrurwwbbburuwu +grburuubguwbuwbbgrwgrwrrubwuuuuwwrggrwwgwbbbwgrbwbg +rugrgguubgbwugwwburrubrwrwgbrgwrgbgrrgrwwwuwgrbg +bugwwwrwwwgwuwbgggbrbgurgurwwgwbbgbgwwguwubwubbbguu +bwubugwbrgbuuwwuwrbbbwuwguwrggrguururbrgubwrrb +gwuurbbgrguwwbwgbwgburwwurbbgrrbbguwrwbubrrwuru +ugruguubruugbggbrwuguruuguwwrurggrgubugrwwgbbbugwrbu +bugubburwbuuwwbubbrwgbwrrbgggbrubbbguwwruwu +ugurwgbuggbugruwbggrrrwrrrbwbrbubbbbuwruwrbwwrrrbwbg +wrgubrbwwgbubuwuurggrbruwrrwrgggwuubbuuruurbbbwugub +ubrurbwrwrrgrrrrwgrrbbuurbbguuwrwururrgwbg +gugbwwuwuuwurubbwuguuuwubgbgwrgrbbguurwruwbrwugwgugwrrruw +rrubbrwwrwggwwrwwwbbbgurruwggwuurggwgbrrguwwwbrrrwrggwwwu +bugrwrgbbwurubugbuubruuugrwubrbubgugrurw +urguwrrbgbbwbwwgrwuwbbuwwubrrrgrwrwbrrrruurrgrrruwuugu +rwugrgbbggururrbbuuubrrgrgggrwuwbrgrwggwgwbuwrurwbug +bugrgbwbgrruurrwgwgbwgwwuuwgrbwbbbuubgrwuwgrgwrgur +wuuwwwrgubbburrrrugrwugubwburwrugbuwuwugbgwggggwbrugbuwwg +rguuurwbgbrubbbuwwbrbbggbburubururbbwwbbruurrgwbrwgwggb +brggrwubuwubrwbgrguwrubburwwgbgbbrwugruubbugwgb +bwrrrguwbbgbwgugbwgggrgbrbuwuguuwrwrwrbwbrbwb +rwbrgwguurguuubrbbgbgubuwuwwbgrggbbwbbwguu +wgrbbruguggrubbwwwurrrwburwrwuwubbwubruwbrgwwubwubwugr +bugrrwurrurwurrbbgrwwrgwwubuwurrbuwwgbwuwubrwbbubbgu +wbbwwgburuwbwgbwwrugwgwwwrrbrrggwrbbugwgub +wrbgbgrugrurwrwubbgrbgurgrbgrgggubuubwwwwgbbwu +wwrruwgubggbwuggbwrugggrbwwuwwrbururbuubbbuuubbr +bbrbbuubgbrbbgrburrwwggrrrurbuwggruugwrrugguruwurbbr +rrbrbwuwbbuwbuubwubbuuugubrubbruurbrggggwugrbbgurbgw +rbrugrbrbwwrbrgwubgbbrwubgwbbbbrgggwugwugwbb +bugwwburwurbugwguwrrrgbbgrrgbgrgurwwurgwwuwggrbrw +buwwwggbugrgugbggbuwbwwurrbwwbbuwuggggbbguug +rrrwbgrbuwuruwbuwbgrwbrbbuuwwruurwggbrgbwwggwgrwrrbgrwgr +rrrugrwuwwrbwgwwrwrubbbwuugbguguwggbrbrwbr +bugugubbggurwwgrrwbuwrggwbgwurbbwrgugubgbugrwrgwgruwugggbrb +buguuwwubbugbwbugggrwbgruuubrrgbuwbwuwrgbwbbwguburwrg +bugwgbgguwugubbrgrwrgruwuwwrrbbggrwwbggwrggb +bugburrrrrubgrgguwwuwrrwbgbwwbbbwubgbbrrru +wgwugrubrggubwwwruubrgbwwggrwubbguwguurrurggr +rruwuwggbbrbwuwwgurrurrwrrbwruguuwbrbrgrrbguwubuwbg +gwbgwgwbrwguwwwwwbubbbwbbbrwubwgggrgugururgrwbbrwbuguubu +bugggubbwggrburwrrggbrubwuubruburbrrggrbgubbrw +rrwubwrgrwgwrbrgbububwbwrrrbwgbruwuuugrgubgwrb +bugbwwuubwwbwwubrbbbrgrrrwubgruwgbgrwgbbbrwbgb +ubbuggrgwrwrggwbbwrrwbrggurgbbbuwbbgurubbwuwruwg +gbwgbgbgwrwbwrbgwuwbbggbrbwgrwrwwurgwguggwuuwubu +bgugbguggrbrwbwggwbbggbrbbrbgbbbugwgwwbgwwwruuuubww +bggrugbrbgggwgwwrwrubwbwuruuggbuuguubggubgwrgbwuubrbrg +bugugggrwrguwrguwggrggbbbwuruuwrbwbuugwgw +gwbugbgwbwwugwruurwgruwwrbbuggwwbugwrugubwgurbugb +urrbgwgubrburgrugurugubuggwuwwbrwwguuuwwruurbbw +buggbrwbwrwwbwgruuuuwrwbwrbgwgwbrwgugggw +wrrwbbgbgrwggbuggrbwwubrwrbuwuuruubbwbrguu +rbwgbrurwuwguubruwubruwwrwguwuwwurggguwburbgu +rggwwwrubrbbrgrurbuggbgwwbrwwwgbwwbgbuugwurbbbrr +urugrrbgwgbrgbrgbgbuwwgrbubrugwbrggggrgrrbguwbuwwruuw +wgugrbwwwurbgwuwubrgrrwbuwrguwwrbgbubrbgwrbwbgwwwu +wbbbuuwwburbgbwwggbbgbrurgbwrwuwuwgrgurgbbubggwbrrggwbbb +wbbwuburwgurgurruwbbrgbrwubuuwrwbbbbwgwggubuwuwubb +gbgbgwrururuggruuuuuurbwbgrwwurggbgggwwurbwuruw +wbrgubgwrruwwgbwrwuwubggugruwurwwbbrggrrgrrwurbwwgwguww +wgwruugrbuguggrubuuurgwrgguuwbbgwrrrbwbgwrrgbrrguurguur +grrwgrwrwgbbrbugbwrbbwburbuurbugwuwbrwbwgrwbwwbggrgwww +wwruwgwuwrwgburbrbuwwggbubbggbugbgbwgururwurrgwbwrbrbbwbrg +bugwwwwwbwgrbwrbbwggbrwgbwubuwwwwwgruurgbgwb +ggwwugruugggbgbwbgbbugwuubwuwwuggugbuuubgbgu +buuuwgbrrwurugwwuuwbgwbuwbbbrwgwgbugbrubbuwwguww +wubwurbwbrrrbubggwrwggwuwubbgbwbrbgbugguguwgggwugugr +bbubrgrwbgwwwwbguruwwwwwgbbruggrbgrrgugrurrggbgrwguuwubwb +ubbwbrubwrbrwurbgrwbgwrrgwrbwwbbgwbgbbruwrwgurubrwbrgbru +wgubbgbgbrbrrgguuubbbwbwgguruwwgrgrgwwurggbgwwruggwrguwwbw +rburwwubguubrgrrrrgrbggruubrrbuggwwrurrbgrguuuwgrrgw +rbruugrrgrggwgwrrrrbubrrrwrbruuwwwguugwubguuruurgrg +bugrbugbrwbugrbbruburugrbugurbubbrwbrruurgurrwgggrrugruwrrrw +rrrrguubrgubbruuubbrwbguwgubwbwwbbbwgrwbrbbwbuwurwguugwwu +buguggrwgwwgrguwgwurbwwwrgwbggwwruuwrbgb +bugubbrrwrurguuuurwgwwrggbbgrrugbrurrgbuugwwwuwbubr +rwbrbuurbgwbbbuurbrbbrbubrbrwrbrbbburbrwuuurgw +uwgwruggrubgwbrwrwgurwuwrwrgwuguubbruwwugbbbg +rwwrgrbgbwwwurbwruuuugbrbggugugrwubrbwugwubwu +bugbbububbuubugwbuuwwurrwbwgrwrrrgggruwuugwuwururugugbbwbggw +gwgbrugggwgruuwgwwggrwwbbwuwrgguwrrbrbubbbubw +bugwwrgwrrbwgbrubbruwgrubbrwwugrwbwrbbrgbgbbbrgbwwwuwwrrgrb +rwbwgwbwuugbbwwrrrrwwbbwrrrrwugwbugugugrgwwwrbbgu +brubuggwuggrbwruubwgrrwgbuurururgugrwurgwbbwbugbgg +wwuuubwurruuwrwwbubgwgurrubwubwbwgrbruguggwgbwwubrwubuwguw +bgwugguubrgurgubgubbwrururuwbwruwwrbbwwgrwgggbrb +rggurbrbrburguwrwwrrwugwgburrrgwbbubwrggwwwuwrgb +buguwgrgrggwgbuugwurgbugwwbbrbgubwwubgwbgwguggwgu +wbuwgubwbbuuuburgurguurggruuwwrbbbwuubgwrwugwwbrwbg +bgbgwwbgrbbwbrwuuuurbuubgruwgwbrwwubwurbuugurrwwuwub +ruwgwwbwrbbrguguwuguuwbguwrggbugbgrgbuggugg +urubrrubgwgbgwgburbbbgbwrbubuuugwwrwuguwrugwwbbr +rwwwggwuwguururrurrggwgbbrwwbwwrwbbrbwrwgw +ugwgbgwrbbggrgggbbgwbbwruguwgurggwbwwrgwrubbwugggwgww +gwwburgwwrwbruurbugwrgwgbbgbgbuguugrgubbugwguwrrrb +rggbwbubwuubugbuubgwurwwgugubwbbgbggrgwbrgbr +bugwuwwgwgurgwwrrrbwuruuggggubgbrrguruwggw +urwrwuugbgrgubrrgubbuwurwbwrbwrwrugrbrrgrburwurgrr +brgrwbubwgrururrrwwbrgubuuuwubwwgwbbugwruwwurrrw +gwbwwurbbgwugwuubggwuuuwggrbrggwgrwurubrggggrwwurggugggbu +bugbwgggwbwuugggbwgrwbrbbbubwwbrgggggbgrurr +bugugrrgugwrbbbggbrwubwwggubbuwurwururgwwrwuwwrgbgbgbug +rrrubrwrwugrugggurbwbbrwwugwruuuuwgrgwurwuwrrrwu +wggrrurgbbwbruurwrggrubrburgrgguwuwuuwbwruwwrugwbbggrggub +buwbrrgwugugburgrruwbgrgrruburbbuubrruwuwuuubwwg +wwwrruurgrgurugurrggggruguuwuurgwrgrbwrrwwgww +bugwwbbrubggwrbrubwbgubrbwuwwbugugbrbgrrrwwug +wbgrwgurrrrwbbuubwgwruuugbugwgbgrrugrrburur +rgbggrugurrwugwrggwwrgbrgwwrwgwugbruurwrbuwgrrgggrgb +wwwwgguwrbrbbgggrggrbrgwgbubwwrrurgubggbrgggb +gbbuwggugwrrbbwbwbrrgguugurrwwuwbbguuwwbrrwbgr +bbuwrububbwwwwgggrrgwwbugwgguuguggwuuwwbwrbbbgwgw +bugrrgbwggrwrubrruwggrwgbbgurwgubgrbwruuggbbbbw +rbbbgubbgggrbbwgbruubrugbgrurrgbrguwgrwugbuuuuuuugbbwrubrb +ugrbrggbwurgbwgbwwbwgwbugwrrwwbrrrwrurugrwurrwgrwgbrwbrb +bwwbugrrbruuwrwrwrbbrbugbbubrurbwwrwrbwwguurbrwurr +wrugbrbggburwuwbrwwubugrgguwrubugwbwrggrwuwrgrgrwuggbgbwr +wburrgbrbbwrbrwuwwuwbrbgbgwgububurrgbuwruguuguwggurbbbr +ubwggwgrwgbbrwuggbgwwbrgrrubuwggwbwrguruwrrgwbbu +bugrbrguuggurugrgbrrurgbgugrbuguuuruwwwr +urrbrwgrgbgwbgggrbwuwggrrrruugbrugbuwwrwguurggbbbg +uwuwuubrurrbrgurgrurbgguuuwgurruuuwrruurbwubww +bugwrwrwubggrwggrubrbgbrurguuugbwubuurwwggbwruggrwggr +ruwgrruwrrwwwgbrubwrbggrburugwbgbrwguwbwwwugrwurwurubg +rrbrgbubrrrwwggwwbbwbgurbgrrrwwuwwurbwwrwugwbrrubru +wbuwgrurbgbururbrwggbgguwwubguurbuubbrbrbug +buuggwgrugrbugwguuurwruuurgrwggrugrrgbwugrrrg +bugbgguurgbwrurrbwgbwgguwwwwrrbrgwrrgubbbugurr +wugrrgrubruubrggugrgrgwbwrrbrrrwbbbwruuurgururrgr +wbgwbguwruwrwwrwbrbuwrgbuurbwuubbrwbwwurbruuurrgwwr +buguwrubuwgwbruburrugruwuburgrrubuwbwrwur +wbwuwwgururwbrurwuurgwbbuwrrrrbbgbgbugrrgwgwwgww +rrguuubburuugugbbwwuwwuwrwrggburrwugrgwrgggrugg +grgwurguugbruubwwbubrrwuruwbuubwbruubbururg +rrgruwbwbwrwgrrrugbwbugrwrguwbgbubwwbrbrrubguurbu +urgurbruggbwrwwgrgrggrrrwruwrurrwrgubbrwbwwrgrwgrwru +rbugrrguwrbrwubgruuwbwgrbwrbbrggggbwgrgwbrrgrwwwbb +rwbugbgugrgwggurguuwrwbwuggwugwguguwruwuggbbwu +bwgbbrbbbbuubrgrbgbwbubwbwgbgbuuuwwuwuwbgwgwbrbgrurwrwbgg +bgrbbwuuwbrrggbwuwwrbggbwwgggugbwggburwrubw +rrrbgrgburwurwgggwwggbbgbgwgugwguuuwuubgwrruw +bugrrbbwgggubwbrwrggubwurbwruwgwuwrbbubrw +ubwrwgwbrgguburwgbguurgwwrrrbggbubbggbrggwbwwwggbgrrbw +uuggbgbgbuubwrbrwwrrwuwbbrugwbbrwwbrbrbuwgruwrr +rwbwbwgrubwurgbrgwgbuburbbugguwrrrrurbbubwgr +rwgubbbugrrbburbbuwgwguguwbgwggbwbuubbuwuwrubuw +gbrbuugbgwbgbbubgbuggwbbrrbgggguuugwbrwuruurrgbwwrbubguw +rrrugbbuurwggbwgrgrugrbgrgbbrubuwbrgwrwgwgwbwgrugbwrb +rgwrwrurgugbbrbubgbuwwwugwrurgwggwbgguruwuurrbuburgrbww +ugbgggubgrrwubugbuwbbgwrrguuuwgubwggrrrgrgg +wbwwggrggwwgwuuwubgwgwuuuuuuwrbrgubrbugbuwrwgrbguburb +bugbwwruurrwrbguwwwbrggrguggwbgrggbbwwuwurwuwrgwuwuubuwuw +buggbggrbggrbbrgwrubbbwgbrgwrwbwrbgwwugburgwuubggr +bgugbrbbgruuguuuwrgggrwuwgurbguubgbgrbbggwgbrwbbrrguuwgrgg +uwwbbuubrrggguwbuuwrurggburburruwggrrrgurgbbu +wwbrurrgbwgbubwbgwbgbgbbwbbbugbwgubwggbwwbbgbgrrrbwww +wbgwuurbggwurbrggwrgwwbbbrwbbrruggbwuwbbbgbwubuwbguwwgg +rrrgwrbguurwrrgrwwubwwrbuwggbgrbwugugwbrgbbbbwrubbburg +brbrrwurugururggbwrwurbwwurubrwrgwbbrubwuu +gbuggbubgwurgrrgrbggbuwwgwurbubrwgruuurrrubb +buguugrwwugbuwgubuugwuubbugrggbguurrrwgwwuru +rgwgbggwuruwurububrbbrbbrwrwgrbwrbuurgwugururbuwu +buggbwgggrgbbwuggbggbubggwgbwuwwgbrwbruubbgwrgurww +ggurwggrburgbrugggrggggbbbbwwbubwbgwgbwgwur +bugwuuuuugrgguwwrbbrgurbuggbbbwwwuurgrug +bugrgbgurbwwrrbgugbbbbburgbrrbugugwgwgbrrgbwrbwwgbbgwgbgwgrg +bugwrrgrbwuggubrrruwggrrbrgggbrggrurrgurgrwburwgu +bugugrwubgbgrrguwwugwbbbrugrwguuwbrrggwwrgbw +bugwuwgrrbgurwbbuwgugguwugbbrrubuwrrguwurrrbwbuwbwbuwb +ubrggwubrgbrrrwguuwbrwruwbguburgurrbbuwwrg +ugwuubbbgbwubbbrugbwrubwgwuurrgburgrrbbugurbwu +wugwrgbbrubggbwruguuwgwuugbgwurubbbbggrgrruggbbgwburg +bgrurbbwgrgwurruwggwbgrgurguwuuguwubugwuuwwuwuuggubbg +wubgruuwburuugrggbrrrwwwuwrgrgrggrrrguwbwrwwwgwwbguguwu +gggururbuwwrgrrrgurgwuggwrwggwuguubwbubugbruuww +rrrggbwbrbwbrggruurbburbbgwguugbwrgububurrggbgruuwgbr +uurbugwwgbrrwwgrgbrrbwwrwwrbbbggrrggggrruwgwururrgwbrgwg +gbrgurggrgwbruwwrwuruwbrbbgwbggwwrbrurrbrrbrgrurbbuuurwwrr +uuwbgugrugrrgwbwwgwwrrguuuwrrggwurbgbugbbguwwgugrw +wrbuwrbrwbugwbrgbubgrwgrugbgrwbwwbwggruugugrbbggwgrwrubrg +urubbgrguggwbwgbuurwurgwgwbggbguggbrrrbbbwu +uugwgrbbuggrwuwwrbbwbuwwgruubuuwguwugrgrwurwrbw +grgrbugwubwgwgrgrgrggggbwururwwuurrubbruwubwguuuguugurwwug +bugwguwrrugrrbbrubrrbwwrubrrwurugwgubgru +bburbwbgbwurwuwuurubwwguwbuuwrrggubbrrgugr +urgwwwurrrbwgugbwgwuwwrwugubwbuubgrruwguugugbuurubwg +uwggugwwgbburgwgbbgwwuuruuubggbugugurgubuuu +guwrgwrbrbwgwbbwwrwubwbrurbuuruguwwuugubbggrwwbbuuugg +buuugugugwbwgrbgwwubbubrbrwrrrgwwgwwgurgrrurguuuwrrgbugw +ubugbrgbbgbguugbbuwugguuuuwwbbwgruuuwbrurwbbbbuuuugrwr +rurrruwugwbgbwgbwuburrurugruuugbwbgbrbwugguwuuwwruwwbw +urrbwuwrwrwbwwwwrwrggbrubrbbwgbrrrbgrgrwbrbgb +bwbbbwrrwgbggwwgrurrrruwrgbbwgrrwbugrbbwrbbrgrbbbgu +uugwuwbwgrugrgwuwgurwbrrrbuwburwwwrgwgggwbugwwurbggbubbgu +urgubuwbwwwgugururwrurrggugugbbwbbubbrubbwwbgguur +bgwbgugugburuwrwwwbgrguurrrguuwubbburrwrugrrrgrguwwwgrr +gggrwrruwbrbgwwurbggwgrwgwgguruwwrgrbrwgrbrwrubbuwwwgbu +rrgrbrguwbwubugrbbguggurwgrwgwbgruuugrbggbuuwuuurwuwgrwwrb +rgrgbbbgbrrwbbruguwgubbgrbrubuwgbrwwuuwbrbbguurgg +wgurbwuubrgurbrbgwgrrububuggubuwrugbuugwbrrgbrwrugbruwwbww +wuwgwuwuruurugbuwrbbubggbgubwggbwbrugrggbrwrgr +rrguggwwgwrurrwuubruwwgbbwrwbwwruurgwbugubbuwbwwruruguwub +rugubbuggurrggrgbwbbuuguwbgggwuwgrgwwbuububuuugrurrwgr +rgwgrrwrrwbrggbgbggrgguggubgrrgruwrrbwguwwbuggrubbgbwurbgw +grbwurbgurrbuwwwrgbugurrrrubwuwgrwgurgubwubgrrbu +gurbgrbwbgurwwgrwgrggugrbgbgwggrwggbbbruurwb +bugrwbbgggugwrrbbuuwrbgrwwbbbwuubwwwrrrb +wgwbwuguwwrwgrwgrwbuwbbuwgwruubbbbrgbbrgbwrguwbwgbu +rrgwrbbuurbrrggrgurrbwubugubuurgbgbgrurrbbwbubguuu +ugrgrgubwbbwwugubgrurwwwbwrwubbwguwgguuwgwbugrwrw +wwbwwrrrbbugbrbwwbwruuuugrggggwbrwbgurwbgbbrbgwguub +wbgwgwgwwrrwbubrgbwrbwrrgggrwwuuuwgurwbwburrubwrurrbruwug +bugugwgurgrbuwgbuururwrrruggrbwwrubburwwbuwrg +bugbuburbgwwurrwgrwbrbuurggruuwuuugbuwwbgwurrubrrbbubuwbgrbr +ubwwwuwrgrwwrgrwrrwbwbrbrubuwguwgbbgbruubbrugw +grgrwurgbbwgubbbgrubrurrbbuguuuuuwgbbbgrrwbuwub +wgwgguuggrrrrwbbgubgurbgurbbrgwgrbuwuguwrbwbrubg +wbwwwbgggwrwgrrwgwububgbrgwrwrrbbbbwuuurbwggguruwugbr +wwurwubrbuubbgwgwurrbbgrguwgbbbgwgwrrbugbrurubwruug +bugbguugugbrggububrrbbrbgbwgbbrrggrruguwb +bugwbuwwwrrwwgwurburrruggbbwugrgwbbugrrbbwrgwuurbrbwg +burbugrrwrugubrurwubgwbwwbbrwurwwgwgwgwwrw +ugrbwguuruggbgwgrbgwwggwgrwrgrgwbwrgwburubgwwr +bugrwwubrgrurugbbwwrggubwgwrbbbgugbrrwrrrbwguwwbbgbbwgur +bwrbugggrwwrruggbggwwbguugwguuuwgbbugbbrbrbrrgugwb +rrwrwgbuwwbruggbwrwwburbuguwuuwwrbrrwbbguwbguwrgwb +gwbgruwrgwrguuugbgrwuwrbubwrwuugubbugugurgbrur +uuurwbuubbruurubugrbbbuurrbuwwbuurrbuggggwwwuguugrgbgr +bggguubrbuguubbrbuwrgurbwrwbbbwwuubgbwrrwbubgbgbuugwrgrw +ggurrgrwruwurggwggbwwuggwuubrbwgwgrwuuuwbwgwggruuwrb +grbubrurwggurruubbrbbguurgrgwbugwuwbgrwgwbwrbbwggwubwbwbb +wbbrbwwugwgwgwgrbrwurwwburbggggrrruububrbbwggwbuu +ubgbggbuubuguwwgbbbgbuwuwwuugggbgrwrwrruwbrgg +bugggwuwrugrbugbrubgwuwwubrrgwgwgbugbwwruggrrggbuggbgubrbb +uwwwwubbuwwubrwrrubbbwbwbrubwwrbwwuurrgguuubr +grgwwwwwuuubwuuwgbbugwbwurbgburrgurbbbgrbwggrburugwrwgrg +brurgugggrguggwrwgrrgubuwwguuwbbrbbwwwburb +buubwrrrgrbrggbuwrubbbgwgubrbwguuwuwwrurrbwwuwr +brgwbrwurwgwwbwwuguwbrwwgggwgggrwbruguwrgubrguuuwgurrwb +bugwwuurbuwbbugrwwbwrubgbgwuguuuubwuwwurbgurr +bwbbrbgurbbruggrbubbrbburbbugbbrrwbwbwbrbgbbgbwrrgru +ubwgwrwgbbgbbrggbrugrubwrgrwgrbbuwbbbguwruwggrg +rrgbrrugwurggggwwwrwbwrgruugrwgrbwguwrgggbwwrgwwubgu +gubwruuuugbwguruwwgbbrwuurwrgrwgubbruurggwggbuuuwbbg +gwgrgbgurruugruurrrbugruugbgbuurbrrrgwurwgbwb +wbbrbwguuwbwgbubrbwggrbbbrgbrubwwwbrrbrwugbubgwrgu +bbwwgbbggbbgugggbrwbugwbbugbburgubgrbggbrbwwugr +rgruuuuwgwbgwuuggbgurrwbgrbwuwuwbwwugbbrrrbgrgbbwurugwuw +ubwwgrrwbbuuugrgbuuuruggbbugbrbbgrwuuuguwurggwgr +buggbwrbbgwwwbubwubwbugbuwububgrubbrwgwgguburwbg diff --git a/day19/main.cpp b/day19/main.cpp @@ -0,0 +1,94 @@ +#include <iostream> +#include <filesystem> +#include <fstream> +#include <vector> +#include <cstring> +#include <cstdio> +#include <tuple> +#include <algorithm> +#include "utils.hpp" + +typedef std::pair<std::vector<std::string>, std::vector<std::string>> Data; + +template<typename T> +T read_file(const std::string &path) { + std::ifstream ifs(path, std::ios::binary); + if (!ifs.is_open()) { + throw std::runtime_error(path+":"+std::strerror(errno)); + } + T buf; + bool is_patterns = true; + while (1) { + std::string str; + std::getline(ifs, str); + if (str.empty()) { + is_patterns = false; + } else if (is_patterns) { + std::istringstream ss(str); + for (std::string s; std::getline(ss, s, ',');) { + std::erase(s, ' '); + buf.first.push_back(s); + } + } else { + buf.second.push_back(str); + } + if (!ifs) break; + } + static auto sorter = [](const std::string &l, const std::string &r) -> bool { + return l.size() < r.size(); + }; + std::sort(buf.first.begin(), buf.first.end(), sorter); + std::sort(buf.second.begin(), buf.second.end(), sorter); + return buf; +} + +const char * patterns_match(const std::vector<std::string> patterns, const char *s) { + if (*s=='\0') return s; + //std::printf("checking %s...\n", s); + const std::string ss(s); + for (const auto &ps:patterns) { + if (ss.starts_with(ps)) { + const char *ns = s+ps.size(); + //std::printf("%s starts with %s, moving to %s\n", s, ps.c_str(), ns); + if (*ns=='\0') { + return ns; + } else { + ns = patterns_match(patterns, ns); + if (*ns=='\0') return ns; + } + } + } + //std::printf("shouldn't be here\n"); + return s; +} + +int64_t part1(Data &input [[ maybe_unused ]]) { + //std::printf("\n"); + int64_t res = 0; + for (const std::string &v : input.second) { + //const std::string &v = input.second[0]; { + //const char *r = patterns_match(input.first, v.c_str()); + //std::printf("........... %s match: %s\n", v.c_str(), r); + if (*patterns_match(input.first, v.c_str())=='\0') { + //std::printf("%s does match\n", v.c_str()); + res++; + //} else { + //std::printf("%s does not match\n", v.c_str()); + } + } + return res; +} +int64_t part2(Data &input [[ maybe_unused ]]) { + return 0; +} + +int main(int argc, char **argv) { + Performance perf; + const std::string fname = argc>1 ? argv[1] : "test1.txt"; + std::cout << "AoC 2024 day 19 " << fname << std::endl; + Data input = read_file<Data>(fname); + std::cout << "part1: " << part1(input) << std::endl; + std::cout << "part2: " << part2(input) << std::endl; + + return 0; +} diff --git a/day19/test1.txt b/day19/test1.txt @@ -0,0 +1,10 @@ +r, wr, b, g, bwu, rb, gb, br + +brwrr +bggr +gbbr +rrbgbr +ubwu +bwurrg +brgr +bbrgwb