diff --git a/Cargo.lock b/Cargo.lock index 959a962..6921625 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,4 +13,128 @@ name = "aoc" version = "0.1.0" dependencies = [ "anyhow", + "rand", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "libc" +version = "0.2.178" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "syn" +version = "2.0.111" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "zerocopy" +version = "0.8.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] diff --git a/Cargo.toml b/Cargo.toml index eb866ea..8bc870b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,5 +39,11 @@ path = "src/day8/main.rs" name = "day9" path = "src/day9/main.rs" +[[bin]] +name = "day10" +path = "src/day10/main.rs" + + [dependencies] anyhow = "1.0.100" +rand = "0.8" diff --git a/src/day10/act.txt b/src/day10/act.txt new file mode 100644 index 0000000..173c815 --- /dev/null +++ b/src/day10/act.txt @@ -0,0 +1,189 @@ +[.##.##] (4,5) (0,5) (2,3) (1,3,5) (0,3,5) (0,2,3,5) (0,1,4) (0,2,4,5) {198,181,22,50,173,65} +[#...##..#] (0,1,3,6,7) (0,1,4,6,7) (0,1,5,6,7,8) (0,1,3,5,7,8) (2,5) (1,4,8) (1,4,5,7,8) (3,5) (1,3,4,8) (0,2,3,4,5,7,8) (0,1,4,5,6,7,8) {38,59,4,35,41,34,31,46,43} +[.#.#.###.] (0,3,4,8) (2,4) (0,1,2,5,8) (3,4,5,6,7,8) (0,1,2,3,6,7) (1,3,5,6,7) (0,1,4,8) (0,1,3,4,7) (0,2,3) {64,47,42,52,33,35,16,20,43} +[....#] (2) (0,1,3,4) (1) (2,3,4) (1,2,3) {16,26,13,28,24} +[#..##] (3,4) (1,2,4) (0) (1,3,4) (2,3) {0,20,38,33,31} +[####.#.] (1,2,3,4,5) (0,1,2,3,4,5) (4,5) (4,5,6) (0,2,6) (0,2) (1,3,6) (0,1,2,3,5) (0,2,5) {227,70,247,70,53,75,201} +[#...###.] (1,4,7) (0,1,3,4,5,7) (0,5,6) (1,2,4,6,7) (2,3,4,5,6) (3,5) {18,27,19,35,41,35,19,27} +[#.###] (3,4) (0,1,2,4) (0,3,4) (0,2,3) (0) (1,4) (1,3) {46,23,25,58,54} +[.#.#] (0,1,2) (1,3) {9,18,9,9} +[##..##.#.] (0,1,2,3,4,7,8) (8) (0,4) (0,1,3,5,6,8) (1,3,4,5,6,7,8) (1,6) (0,2,5,7) (0,2,4) (3,4,7) (0,1,2,4,5,8) (1,3,7,8) {47,58,37,38,44,46,28,40,54} +[...#] (0,1,2) (0,3) (1,3) (3) (2,3) {12,22,9,40} +[.....#.#..] (0,1,2,3,4,6,8) (0,2,3,6,8,9) (0,2) (1,3,4,5) (0,1,2,3,4,5,6,8,9) (3) (1,3,4,6,7,8,9) (0,3,4,7,8,9) (1,5,6) (1,2,4,5,7,8,9) (2,3,4,5,7,8) (3,4,5,8) {61,66,74,87,77,53,62,59,93,68} +[.#..#] (1) (1,2) (0,1,2,3) (0,1,4) (1,3) (1,3,4) {18,69,35,36,13} +[.....#] (0,1,2,3,4,5) (1,2,3,4,5) (3,5) (0,1,2,4,5) {114,120,120,20,120,130} +[#.#.##.] (1,2,4,5) (1,5) (0,1) (3,4,5,6) (0,1,3,4,6) (1,2,3,4,5,6) (0,2,3,5) (0,1,2,5,6) {37,39,16,33,26,30,23} +[.####.####] (0,3) (2,4,6,8,9) (4,5) (0,2,3,4,5,6,9) (0,1,4,6,7,8) (0,1,2,3,5,6,7,8,9) (0,1,2,4,5,6,8,9) (1,6,7,8) (5) (8) (4,5,6,7,8) (5,7,8,9) (1,3,4,5,8) {56,62,21,50,55,57,57,49,257,21} +[....#.] (1,3,4,5) (0,1,2) (2,3,4,5) (0,1,2,4) {17,27,27,20,28,20} +[..##] (0,3) (0,2) (2,3) (1,2) {17,9,31,27} +[..###] (2,3) (0,1,4) (0,1,3) (1,3,4) (1,2,3,4) {7,12,18,30,5} +[#.##] (1,3) (0,2,3) {6,10,6,16} +[.####] (1,2,3,4) (0,2,4) (0,1,3) {18,20,10,20,10} +[####.] (0,1,2,3) (1,2,3) (1,2,4) {1,172,172,7,165} +[#.....####] (2,4,5,6,7,8) (0,2,3,4,6) (0,1,2,3,6,8,9) (0,1,2,3,4,6,8,9) (0,1,2,4,8,9) (0,1,3,4,5) (3,6,7) (0,2,6,7) (0,4) (0,2,3,4,5,6,7,9) {239,210,239,72,227,26,84,34,214,202} +[#.#.] (0,2,3) (1) (0,3) (0) (1,2) {132,14,126,116} +[###.##.#.] (1,3,6,8) (1,2,3,4,7,8) (4,7) (0,1,2,3,5,6,7) (0,2,4,6,8) (0,1,2,3,7,8) (3,5) (4,5,6) (0,1,2,3,8) (2,3,4,5,6,7,8) {17,116,121,127,148,31,33,132,122} +[.#..] (0,2) (0,1,3) (0) (2,3) (0,3) {34,12,30,33} +[...#.] (0,1) (3) (0,2,4) (0,2,3,4) {217,10,207,210,207} +[....#..##] (0,4) (0,2,4,8) (0,1,3,4,6,7,8) (0,1,3,6,7) (1,2,3,5,8) (1,2,3,4,5,7,8) (1,3,4,5,6,7,8) (2,3,8) (1,2,3,4,6,7,8) (0,1,2,3,4,8) (0,1,2,3,5) {63,89,91,105,88,49,35,55,98} +[#.###...] (0,4) (0,2,3,4,6) (1,2,4,5,6) (0,2,3,4) (5,6) (1,7) (7) (3,4,6) {12,36,31,22,41,32,45,26} +[.##..#.] (0,4,5,6) (0,1,2,3,4,6) (1,4) (0,2,3,4,5) (5) (0,2,4,5) {142,13,27,15,143,140,127} +[########.] (0,1,3,4,5,6) (3,5,7) (3,4,5,6,8) (1,5,7) (0,5,8) (0,1,3,4,6,7) (2) (2,3,4,6,7,8) {34,32,15,50,46,54,46,29,34} +[..#.#.#.] (0,3,4,5,7) (0,1,2,3,4,6,7) (0,2,3,7) (0,1,3,4) (0,4) (0,1,2,4) (4,6) (0,1,2,3,4,6) (2,3,4,6) (0,1,2,4,5,6,7) {77,56,57,60,187,25,156,44} +[.#..#] (2,3,4) (1,2) (2,3) (4) (1,3,4) (3,4) (0,2) {5,19,22,50,54} +[..#..] (0,1,2,4) (1,2) (0,3) (1,2,4) (1,2,3) (1,3,4) {36,67,50,40,41} +[#.#.#.] (0,2,4,5) (0,4) (0,1,4) (1,3) (0,2,4) (0,5) (2,4) {56,9,26,4,41,24} +[.##.##..] (7) (0,1,2,4) (0,2,3,7) (0,1,2,3,5) (2,7) (1,2,3,5,6,7) (2,3,4,5,6) (0,2,4,6) (0,3,6,7) {69,33,75,56,32,33,46,50} +[.###.] (0,2,4) (0,1,2) (1,2,3) (2,3,4) {18,23,35,17,12} +[..##..#] (0,5) (0,3,4) (0,1,2) (0,1,4,5,6) (1,6) {53,48,19,13,28,21,29} +[##.#] (1) (0,3) (2) {164,20,14,164} +[###.] (0,1,2) (1,2,3) {11,186,186,175} +[##....#] (0,1,2,4) (0,1,3,5) (0,1,2,6) (0,1,3,4) (0,3,6) (0,4,5) (0,1,2,4,5) {188,168,153,25,44,33,137} +[.#####.#] (0,2,7) (0,1,2,3,5,7) (0,1,3,5,6) (0,1,2,3,5,6,7) (0,3,4,5,7) (0,1,5) (1,2,4,5,6,7) (1,3,4,6,7) {56,76,55,44,30,71,47,66} +[#.#...##..] (0,1,2,4,5,6,8,9) (0,2,3,4,5,6,8,9) (0,1,5,8) (0,3,6,7,8,9) (0,6,7,9) (5,6) (0,2,3,7,9) (1,2,3,4,5,9) (2,4,8) {77,19,62,52,46,43,67,51,62,78} +[..#.] (0,1) (0,3) (2) {24,17,11,7} +[##.#] (0,2) (1,2) (0,3) (2) (1,3) (0,1) {42,36,37,19} +[.#####..##] (0,7,8) (0,1,2,3,5,7,8,9) (1,6) (2,6,8) (4,5) (1,3,4,6) (0,1,2,4,7,8,9) (4,5,6,8) (0,9) (6,7,8) (1,3,5) {23,38,23,21,42,23,52,21,41,21} +[#...] (0,1) (0,2,3) (0,3) (2,3) (1) (1,2) {221,21,203,217} +[.#.###] (0,1,2,4,5) (0,2,3,5) (0,1,4,5) (1,2,3,4,5) {154,32,156,152,32,169} +[..#.##] (2,3,4,5) (0,1,4) (0,1,2,3,5) (4) (3,5) (2,3) (0,1,2,4,5) {20,20,25,25,30,29} +[.#####.#.] (0,2,3,4,6,8) (0,1,3,4,5,6) (0,1,2,4,5,7) (2,5) (1,2,3,4,7) (0,1,2,4,5,8) (0,1,2,3,5,6,7) (0,2,3,4,7) (0,6,8) (1,8) {52,47,57,27,31,43,34,30,41} +[##.#.] (1,4) (0,1,3) (3) (0,4) (0,3,4) (2,4) {27,29,13,27,39} +[#..###....] (0,3,4,5,6,7,9) (0,3,4,5,6,7,8,9) (0,3,6,8,9) (0,1,5,6,7,9) (0,2,3,6,7,8,9) (4,6) (0,1,3,4,5,8,9) (0,8) {90,30,7,61,49,51,80,45,69,78} +[##..###] (0,1,3,4) (1,2,5,6) (2,3,5,6) (1,5) (1,3,4,5) (0,4) (2) {31,51,35,36,34,48,26} +[.###.####.] (1,2,3,4,5,7) (0,1,2,4,6,7,9) (1,2,3,4,5,6,8,9) (1,2,3,6,7,9) (1,3,5,6,8) (5,6) (0,2,5,6,7,9) (0,5,7,8) (1,2,3,4,7,8,9) {27,74,89,70,52,70,71,82,39,72} +[###.....#.] (6,8) (3,4,5,7,9) (1,2,7) (0,1,2,4,7,8,9) (1,4,7,9) (0,2) (2,4,5,9) (1,3,9) (5,8) (0,2,4,5,7,9) (1,2,3,4,5,7,9) (2,4,5,7,9) (3,4,7,8,9) {28,34,37,37,74,45,9,72,55,77} +[.###.] (1,4) (0,1,3) (1,2,3) {3,11,2,5,6} +[##....#.] (2,3,4,6) (1,2,5,7) (1,4,7) (0,2,3,4,5,7) (1,2,3,5,6) (2,3,4,5,6,7) (0,2,3,5,6) (0,2) (2,6,7) (1,4,6,7) {27,177,232,72,72,184,90,203} +[###.###..] (3,4,7) (0,1,2,3,4,5,8) (4,6) (0,3,4,5,7,8) (0,1,2,3,5,6,7) (0,1,2,4,6,7,8) (0,8) (1,2,7) {261,233,233,245,246,234,41,70,241} +[#..#..#] (0,1,2,5,6) (2,3,4) (0,1,2,3,5,6) (1,2,3,5) (0,1,2,3,4) {159,162,179,178,166,13,10} +[...#.#...] (0,3,4,5) (1,5,7,8) (4,6) (0,2,3,4,6,7,8) (2,4,8) (0,1,2,3,4,5,7,8) (3,5) {29,8,43,29,61,14,28,24,44} +[##..###.#] (0,1,2,4,5,6,8) (3,4,5,6,7) (0,3,6,8) (5,6) (2,3) (0,2,3,4,5,6) (0,1,2,3,4,5,6,8) (0,1,2,3,5,7) (2,8) (0,2,3,4,5,6,7,8) {61,34,222,204,64,74,71,25,53} +[##.#] (0,1,3) (0,2) {178,168,10,168} +[#..##] (0,2,4) (0,3) (0,1,3,4) (0,1,3) (0,1,2,3) {27,22,6,23,23} +[###.#.] (1,2,4) (2,3,4) (3,4) (0,3) (0,2,5) (1,2) {23,11,45,31,26,18} +[..##.###..] (4,5,7) (0,1,2,3,4,6,7,8,9) (0,1,2,3,4,5) (2,3,5,6,7) (1,2,3,8,9) (0,1,2,3,4,5,8,9) (0,5,6) (0,1,2,3,4,5,7,8) {21,38,42,42,35,39,4,21,21,18} +[.##.] (0,1) (0,3) (0,2) (1,2) {42,4,21,19} +[...###.] (1,2,3,5) (1,3,4,6) (0,1,2,5,6) (1,2,3,5,6) (0,1,6) (2,4) (1,2,5) (3,4,5) {23,47,28,30,11,38,34} +[#...#] (2,3,4) (1,2,4) (0,1,3) (0) (2,3) {3,5,16,11,9} +[.#.#..#] (0,1,4) (1,2,3,6) (4) (1,2,3,4,5) (0,2,3,5) (3,4,5) (2,4,5,6) (2,4) {23,38,67,37,80,43,28} +[.##.#] (0,1,2) (0,2) (0,2,3,4) (2) (2,4) {29,13,47,0,12} +[#.#..#.] (3,4,5,6) (4,6) (0,1,2,4,5,6) (0,1,2,3,5) (1,3,4,5,6) {14,26,14,28,30,28,30} +[#...#...] (0,1,2,3,4,5,6) (0,1,4,5,6,7) (0,1,2,3,6,7) (0,3,4,5,6,7) (2,5) (0,2,3,5,7) (0,3,4,5,6) (5,7) (1,7) {85,41,45,72,58,99,68,84} +[.#..##..##] (2,3,5,6,7,8,9) (2,3,5,7,9) (2,3,4,5,8) (0,1,2,3,4,5,6,7) (0,5,7,8) (2,3,4,5,7) (1,4,6,9) (6,8) {21,5,51,51,19,69,22,56,48,36} +[#.##.##.#] (3,8) (0,3,4,5,6,7,8) (1,4,8) (0,2,4,5,6,7,8) (0,1,2,3,5,6,7,8) (0,1,2,4,5,6,8) (0,1,3,4,5,6) (0,1,2,3,4,7,8) {258,240,240,50,246,245,245,57,254} +[.#.##...] (0,3,4,5,6,7) (3,6) (1,5,7) (0,2,3,5) (3,4,5,7) (0,2,4,7) {18,8,12,26,22,22,18,30} +[####..##..] (0,2,3,5,7,8,9) (1,3,4,7,8) (1,2,3,6,7,8,9) (1,7) (0,3,4,5,8,9) (2,3,4,5,6,7,8,9) (0,2,3,5,6,7,8,9) (2,5,8) (1,5,9) {38,43,72,83,48,90,40,65,101,89} +[.#.#.#] (0,1,4,5) (3,4,5) (0,1,2,4,5) (1,2,3,5) (1,2,3,4) (1,2,3,4,5) {20,54,49,48,62,59} +[#.##] (1,2) (0,1,3) (0,2,3) {23,28,35,23} +[#.##.#..##] (4,5,7) (0,2,3,4,7) (1,2,3,4,5,6,8) (1,2,3,5,6,8,9) (2,7) (0,1,5) (1) (1,2,5,6,7,8) (1,4,5,7,8,9) (0,3,6,7,9) (0,1,4,5,8) (0,4,6,9) {49,72,49,37,89,72,50,67,56,46} +[...#.] (1,2,3,4) (2,3) (0,2,3,4) (1,3,4) {20,25,177,184,45} +[#...##] (0,2,4,5) (0,4,5) (0,1,2,4) (4,5) (0,1,3,5) (0,1) (3,4,5) (2,4) {48,28,10,28,40,57} +[##.#...##.] (0,4,8) (0,1,4,6) (3,5,7) (1,5,8,9) (4,5,8) (1,2,3,5,7,8,9) (2,5) (1,3,9) (0,1,2,8) (0,2,6,7) (2,3,4,5) {215,41,227,39,64,85,195,207,68,30} +[.##.##] (0,1,3,4,5) (0,1,4,5) (0,2,3) (0,1,2,3,4) {25,20,19,24,20,6} +[##...##.] (1,3,4,5,6,7) (0,1,2,3,4,5,6,7) (1,2,4,5,7) (0,1,2,6) (1,2,3,6) (1,2,3,4,7) {8,50,33,30,43,41,30,43} +[##..] (0,2) (0,1) (0,3) (3) (1,3) {11,20,4,30} +[...#] (0,1,2) (0,2) (0,2,3) {32,10,32,12} +[#####.] (0,2,5) (3) (1,2,3,4) (0,1,2,3,4) (0,3,4,5) {13,167,170,186,168,4} +[###..#.#] (4,7) (0,1,7) (1,3,4,5,6,7) (2,4) (0,3,4,5,6) (1,2,4,7) (2,5,7) (0,1,2,7) (2,4,6) {24,128,164,20,181,33,39,160} +[....#..##] (2,4,6) (0,1,6,7,8) (0,2,4,5,7,8) (1,2,3,4,5,6,8) (2,5,6,7,8) (2,3,4,5,6,8) (1,3,4,5,6,7,8) {14,24,61,32,47,61,54,34,63} +[.####.#.] (0,1,2,4,5,6) (1,2,4,5) (0,2,3,6) (1,2,3,5,6,7) (0,2,6,7) (1,6,7) (2,3,5) (1,4,5) (1,2,3,4,6) {40,140,66,30,28,42,157,130} +[###..##.##] (3,4,6,8,9) (0,5) (0,1,3,6,7,8,9) (4,8,9) (1,2,3,4,5,7,9) (1,2,3,4,6,7,8,9) (0,3,5,6) (4,6,7,9) (1,2,3,4,5,6,7,8) (0,1,2,5,6) (1,3,5) {6,33,21,42,42,26,30,30,32,39} +[###.###.] (5) (1,4) (3,5) (0,4,5,7) (0,1,2,4,5,7) (1,5,6) (0,4,5,6,7) (0,1,2,4) {27,31,9,5,45,46,12,19} +[###..#.###] (0,2,6,9) (1,4,5) (0,5) (0,1,4,6,7,8,9) (2,3,4,6,8,9) (0,5,7,9) (0,3) (1,2,4,7,8,9) (3,8) (3,5,8,9) {42,38,33,19,43,12,37,40,55,57} +[..##...##.] (5,7) (0,4,6,7) (0,6) (1,2,4,7,9) (0,3,4,6,7,8,9) (0,2,3,5,6,8) (0,1,2) (1,3,5,8,9) (0,1,2,3,5,9) (1,2,4,5,6,7,9) (0,2,3,4,7,8,9) {169,64,189,161,44,178,146,60,149,62} +[###...#.#.] (0,1,2,3,4,7,8) (0,1,3,9) (1,2,5,6,8,9) (0,1,4,5,7,9) (1,2,7,8) (5,6) (3,6,7,8,9) (5,6,8) (2,3,6,7,8) {32,50,39,49,13,45,62,48,62,50} +[##.##] (1,2,4) (2,3,4) (3) (0,1,4) {2,21,39,172,41} +[.####.###.] (1,3,8,9) (0,2,3,4,7,9) (1,3) (2,3,4,5,7) (0,5,6,8) (0,1,4,8,9) (0,3,4,8) (1,2,4,5,6,7) (1,2,3,4,6,7,8,9) {55,56,38,56,69,31,32,38,67,54} +[..##..#.] (0,1,3,4,5,6,7) (1,2,4,5,6,7) (3) (0,3,5,6) (0,1,2,3,4,5,7) (0,4,5) {39,36,30,46,43,50,24,36} +[####..#.#] (1,3,4,7,8) (1,2,4,7,8) (0,2,4,5,7) (2,3,5,7,8) (6,8) (0,1,2,4,5,7,8) (0,2,4,5,6) (0,1,3,4,5,7) (0,4,7) (0,1,2,3,4,6,8) {46,41,63,31,72,54,218,60,246} +[....#.#.] (0,1,2,4,6,7) (1,2,4,5,7) (0,1,3,4,5,7) (2,5,7) (0,1,2,4,5,6,7) (0,4,5) {57,61,60,20,62,64,36,80} +[#..###] (0,1,2,5) (1,5) (0,1,2,3,4) (1,2,3,4) (0,5) (0,2,3,5) {51,54,37,18,17,53} +[.#.#.#..] (0,2,3,4,5,7) (0,2,4,5,7) (0,1,5,7) (0,1,2,3,5,6) (1,4,7) (5,6) (3,4,5,7) {43,16,37,33,40,73,28,46} +[.#..] (0,1,3) (0,2,3) (1) {21,20,11,21} +[.....#.###] (0,1,2,4,6,7,9) (0,5) (2,4,5,6,8,9) (2,9) (1,4,5,6,7,8,9) (3,4) (0,3,4,6,7,8,9) (0,1,3,4,5,6,7,8) (0,1,3,9) (2,4,5,6,7,9) {43,40,47,26,64,44,57,47,35,82} +[...#.#.#.] (1,2,3,4,7) (1,4,6,7) (0,1,2,5,6,8) (0,1,2,3,7,8) (0,1,2,3,4,6,8) (1,3,4,5,6) (0,1,3,8) (7,8) (3,5,7) (2,3,4,5,6,7,8) {34,61,47,70,40,42,34,58,45} +[##.#..#] (1,2,3,6) (2,5) (0,5) (0,1,3,4,5) (0,1,3,6) (1,4,5,6) {8,143,11,7,136,148,143} +[......###] (0,1,2,3,4,8) (2,3,5,6,7,8) (0,1,3,4,6,7,8) (1,3,4,5,6,7,8) (4,5,7) (0,1,3,4,7,8) (2,4,7) (0,1,4,6,7,8) {46,51,23,43,79,21,34,74,53} +[######] (0,4,5) (0,1,2,3,5) (4) (0,1) (0,2,3) (1,3,4,5) (2,4,5) {31,15,24,18,30,22} +[#...#] (1,4) (2,3,4) (0,2,3) {17,10,29,29,22} +[##.#.#...] (2,3,4,8) (1,2,3,4,5,7,8) (0,3,4,5,6,8) (1,2,3,5,6,7) (1,4,5) (0,1,4,5,6,7,8) (0,1,2,3,6,7,8) (3,5,6) (0,5,6,7) (1,3,4,6,7,8) (0,1,2,3,5,7) {23,75,53,85,70,78,51,62,54} +[.##.###] (2,3,6) (1,2,3,5) (2,3) (0,4,5,6) (1,2) (0,3,4,5,6) (1,3,4,5) {13,23,19,38,28,32,23} +[.####.#] (3) (1,5,6) (0,1,2,3,6) (0,1,4,5,6) (1,4,5) {28,40,19,20,19,21,30} +[.#.#.#] (0,2,4) (0,1,2,5) (4) (0,2,3,5) (0,1,2,3) (1,2,4) (0,1,4,5) (1) {44,44,53,20,186,19} +[###..] (0,3,4) (0,1,4) (0,1,2) (1,3,4) (2) {35,27,30,28,28} +[#.###.###.] (1,2,3,4,5,6,7,9) (0,3,4,6,8) (2,4,7,9) (0,2,5,9) (0,3,7,8) (1,2,3,4,5,6,8,9) (1,8) (0,2,3,5,6,7,8,9) (1,3) (0,1,3,6,7) (0,5,7,8,9) (1,2,3,5,7,8) (1,2,3,4,5,6,8) {46,62,75,70,45,86,54,54,78,75} +[#...##.###] (2,3,5,7) (0,2,3,4,5,6,8,9) (2,3,6,9) (1,5) (2,5,8) (0,1,3,4,5,7,8) (0,1,2,4,6,7,8,9) (0,3,4,5,7,8,9) (0,5,6) (3,4,5,6,7,8,9) (0,1,4,5,6,8,9) (0,1,2,4,5,6,9) (0,2,3,4,5,6) {94,33,68,71,79,111,84,36,63,79} +[###.###..] (1,2,3,6,7,8) (0,2,3,4,5,7,8) (2,6,7) (5,7) (4,6,7) (2,3,4) (1,2,3,4,5,6,7) (0,4,8) {13,4,26,15,31,6,20,22,13} +[#...#] (2,3) (0,1,2,4) (0,4) (0,2,4) (1,2) {24,30,46,14,24} +[..#..#.##.] (1,8) (1,6,7,9) (0,3,8) (0,1,2,4,5,8) (0,4,6,9) (1,2,3,5,6,7,8,9) (0,1,2,3,5,6,9) (4,5) (1,3,7,8) {30,35,13,19,30,27,27,17,29,27} +[....#.##.] (0,2,3,5,6,7,8) (1,3,4) (2,3,6,7,8) (1,2,3,5,6,8) (1,2,3,4,6,7,8) (2,5,7,8) (3,8) (0,5,6,7,8) (0,1,3,4,5,7) {23,43,58,84,28,39,57,56,72} +[###.#.] (0,2) (0,2,3,4,5) (3,5) (0,1,2,4) (2,3,4,5) {31,14,31,28,24,28} +[#.#......] (0,1,2,4,5,8) (0,1,2,3,4,5,6,8) (2,3) (0,1,3,7) (0,4,6,8) (4,5) (0,1,3,4,7,8) {75,61,23,47,64,30,23,38,57} +[#..####..#] (0,1,2,3,5,6,7,9) (6,7,8,9) (1,3,5) (0,6) (0,1,5,8,9) (2,6,7,8) (0,2,3,4,6,7,8,9) (0,1,4,5,7,8) (2,3,5,6,7,8,9) (0,2,3,4,5,7,8,9) (1,3,4,6,7,8) (0,4,5,8,9) (0,1,2,5,6,7,8) {97,72,75,76,50,94,83,89,97,82} +[#.##..] (0,3) (1,2,4,5) (1,2,3,5) (0,4) (0,2,5) (0,1,3,4,5) (0,1,5) (1,2,3,4) {47,64,63,47,47,67} +[#..##] (3) (1,3) (2) (0,2,3) (0,1) (0,1,2) (0,1,4) {6,10,126,21,3} +[###..###.#] (0,3) (3,4,9) (0,2,6,7,9) (4,6,7,8,9) (3,9) (2,3,5,9) (1,4) (1,2,4,6,7,9) (1,3,4,6,7) (0,4,5,6,7,9) {48,37,27,224,87,24,70,70,12,237} +[..##......] (0,2,5,6,9) (0,2,3,4,5,6,8,9) (0,1,4,5,7,8) (0,2,3,5,6,7,8) (1,7) (0,1,2,3,4,6,7,8) (0,1,3,4,6,7,8,9) (5,7,8,9) (0,1,3,4,5,6,7,9) (2,3,4,5,6,8,9) (0,1,3,7,8,9) (2,4,7) {230,50,217,218,66,218,212,244,232,60} +[###.#.#] (2,5) (2,4) (1,2,4,5) (0,1,4,5,6) (0,3,5,6) (2) (0,3) (1,4,5,6) {25,19,54,19,35,51,28} +[#.###.] (1,2) (0,1,2,5) (1) (0,1,2,4,5) (2,3,4,5) {30,56,47,11,28,41} +[###.#.#.#.] (2,5,6,7,8) (0,1,3,6,9) (0,3) (0,1,9) (3,7,8) (1,2,3,7) (0,1,5,6,7,8) (3,5,7,8) (1,3,5,9) (0,2,3,4,5,6,7,9) (3,5,7,8,9) (1,2,3,7,8) {46,79,165,112,17,173,148,206,171,61} +[.#...] (0,1,4) (0,2,3) (0,1,3) (1,2) (1,3,4) (3,4) {34,43,19,64,36} +[###.#..] (0,5) (0,1,2,4,6) (0,3,4,5) (0,1,3,4,5) (0,3,5) (0,2,3,4,6) (0,1,2,6) (0,3,4,5,6) {239,18,187,224,225,52,205} +[..#...#] (1,4,5,6) (0,1,2,3,4,6) (2,6) (0,4,6) (0,4) (0,3,4,5,6) (1,2,5) {46,17,13,25,53,32,50} +[......#.] (1,4,5,6) (2,4) (1,2,7) (0,2,5,6,7) (2,5) (0,1,2,4,5,7) (3,6) (0,1,2,6,7) (0,6,7) (1,2,6,7) {23,41,50,0,9,15,36,50} +[..#....#] (0,3,4,5,6,7) (0,1,2,3,4,7) (3,6,7) (0,6,7) (2,4,5,6) (0,1,2,3,7) (0,1,2,5,6) {43,22,28,35,30,19,30,44} +[#.##.] (2) (0,2,3,4) (0,2) (0,2,3) (0,4) (1,3,4) {145,4,147,141,7} +[.##......#] (0,1,2,3,4,5,7,9) (3,7,9) (0,1,3,4,6,7,9) (0,2,4,8,9) (0,1,3,4,6,9) (0,2,8,9) (2,3,5,7,9) (1,3,5,6,7,9) (0,2,3,5,6,7) (1,2,6,9) {81,36,81,64,49,43,45,46,33,84} +[##...###.] (0,4,6,7) (0,1,2,3,5,8) (1,2,4,5,7,8) (1,3,4,5,7) (1,5) (0,1,5,6,7) (3,6) (0,1,3,5,6,7,8) (1,2,5,6,7) (3,4) (2) {22,51,40,24,41,51,42,54,24} +[..#.] (3) (0,1,2) (2,3) (1,2,3) {1,147,149,165} +[..##.#.#] (0,1,3,4,5,6,7) (2,5,6) (3,4) (0,1,4,5) (4,6) (1,2,3,4,6,7) {7,22,28,23,37,20,39,17} +[...#...#] (0,2,4,5) (0,2,3,5,6,7) (0,2,4,5,7) (4,7) (0,3,6) (2) (0,1,2,5,6,7) (0,3,5,6,7) (0,1,2,4,5) (1,2,5,7) {60,35,77,16,36,71,35,64} +[..#..#.] (0,1,5) (3,4,6) (1,3,4,6) (0,2,6) (0,3,5,6) (1,2,3,4) (0,6) (1,4,6) {39,50,13,31,45,20,57} +[..#...] (0,1,2,5) (0,4,5) (1,3,4,5) (1,4) (0,1,3) (1,2,3,4,5) {122,58,22,36,148,144} +[#.##...] (3,4) (2,5) (0,2,3,4,5) (1,2,3,4) (0,1,2,4,5) (0,6) {41,7,28,21,28,28,14} +[.##....##] (1,4) (0,1,2,3,8) (0,1,2,3,4) (2,3,4,6,7,8) (0,1,3,4,5,6,8) (7,8) (0,2,5,6,8) (1,2,3,4,5,6,7,8) (4,6,7) {32,35,48,39,60,11,39,43,41} +[#.##] (1,2,3) (3) (2,3) (2) (0,2,3) (1) {14,168,60,51} +[...##...#] (0,1,2,3,5,6,7,8) (0,4,5,7) (3,4,8) (0,2,4,5,6) (1,2,3,5,7,8) (0,1,2) (0,3,5) (1,3,5,6,7,8) (1,3,5,7,8) (0,1,2,4,5,6,7,8) {68,55,43,52,30,68,29,52,45} +[#..##] (0,3,4) (1,4) (1,2,4) (1,2) (0,1) (0,4) {28,31,18,8,18} +[#.##...##] (0,2,3,4,5,7,8) (2,3,4,5,6,7,8) (0,1,2,4,5,7,8) (0,6,7,8) (0,1,3,8) (1,6,8) (2,8) {42,23,170,46,28,28,34,41,205} +[###.#..#] (0,5,7) (1,4,5,6) (0,1,2,3,5,6,7) (1,3) (1,2,6,7) (0,3,5,6) (0,5,6,7) {33,49,31,28,7,40,44,47} +[...##] (0,2,4) (1,3,4) (2,3,4) (1,3) (3,4) (0,2) (0) {49,13,31,17,19} +[.##...#.] (0,1,2,3,4,5,7) (0,2,3,4,6,7) (0,1,2,4,5,6,7) (1,2,4,5,6) (0,1,3,5,7) (0,1,2,4,6,7) (4,5) {76,63,60,52,67,53,43,76} +[....##...#] (3,6) (0,1,2,4,5,6,7,8,9) (0,1,2,3,4,7,8) (2,3,4,5,7) (2) (3,5,6) (3,4,5,6,9) (0,2,4,5,6,8,9) (0,3,4,9) (0,2,3,4,5,6) (0,4,6,7,8,9) (2,3,6,8) {60,13,70,71,64,47,84,28,47,39} +[..##.] (4) (0,1,4) (1,2,4) (0,3,4) (2) (0,2) {32,35,43,4,49} +[.#...#] (0,3,4,5) (0,2,5) (0,2,4,5) (0,1,3,4) (2,3) (1) (0,2) {62,23,43,29,30,33} +[##...#####] (2,3,4,6,7,8) (9) (1,2,8,9) (0,4,9) (0,1,2,3,4,5,6,9) (1,3,4,5,6,7,9) (0,7) (1,8) (0,1,3,4,6,7,8) (0,2,5,9) (0,1,5,6,7,8,9) (7,8) {183,182,41,175,177,32,183,180,177,54} +[##.#] (0,1,2) (1,2,3) (2,3) (1) (0,2) {18,26,29,11} +[#..##.#] (3,4,5) (4,6) (3) (1,2,3,4,6) (1,3,4,5,6) (0,2,4,6) (0,1,5,6) (1,2,3,4,5,6) (1) {10,47,23,42,51,31,53} +[...#.] (1,4) (1,3,4) (0,1,3) (1,3) (2,3) (3,4) (4) {11,36,2,44,198} +[#.#.] (0,2) (1,2,3) {20,156,176,156} +[#....] (0,1,3,4) (0,1,2,3) (1,2,3) {28,29,15,29,14} +[###...] (0,4) (1,2,4) (1,5) (0,1,2,3) {12,38,26,11,16,12} +[..###.] (0,1,3,4) (0,2) (4,5) (2) (0,1,2,4) (1,3,5) (0,1,2,4,5) {32,26,38,3,36,19} +[..#..#.] (0,1,3,5,6) (3,4,5) (0,4) (1,3,5) (0,1,4,5,6) (2,5) (2,3,4,5,6) {39,44,26,48,45,78,51} +[#...] (1,3) (2,3) (0,3) (0,1,2) {11,15,7,24} +[##.####] (1,2,4,5) (0,1,2,3,5) (2,3,6) (3,4) (0,1,3,4,6) {27,42,41,207,196,35,13} +[...#...#] (0,2,3,4,6) (1,2,3,7) (6,7) (2,5) (0,2,4,5,6,7) (0,1,2,3,4,5) (3) (0,1,3,7) (3,6) {44,27,31,58,24,10,33,36} +[####...##] (4,5,6,7,8) (0,2,5,6,7,8) (0,1,3,4,6) (3,8) (2,3,4,6,7) (2,4,6,7,8) (0,1,2,3,4,6,7,8) (0,4,7,8) {33,22,51,43,64,23,75,63,56} +[.##..#] (0,2,3) (2,3,4) (2,4,5) (0,1,4) (1,5) (5) (0,1,2,3,4) (1,2,5) {33,43,47,32,40,33} +[.##.#..#..] (1,2) (0,1,2,3,5,7,8) (3,7,9) (0,1,2,4,5,6,8) (2,7) (0,1,2,3,4,6,7,8,9) (0,1,2,6,7,9) (4,6) (0,1,5) (0,1,3,4,5,7,8,9) {46,66,57,39,35,42,17,58,37,31} +[##.#] (0) (0,1,3) (1,3) (1,2) (2,3) (0,1,2) {21,35,28,39} +[####..#.#] (0,1,2,3,4,5,7) (4,5) (6,7,8) (1,2,3,4,5,6,8) (0,3,4,6,7,8) (0,2,4,5,8) (0,1,2,3,5,6,8) (3,7,8) (0,2,4,5,7) {48,37,47,62,67,59,62,52,67} +[.#.##.#] (3,5) (5,6) (0,1,2,3,5,6) (2,3) (0) (1,4,5,6) (1,2,4,6) (0,1,3,5) (4) {33,62,31,42,41,72,61} +[.#####] (1,2) (0,2,4) (3,5) (4) (0,2,5) (3,4,5) (0,1,3,5) (3) {32,7,25,202,32,200} +[..#.] (0,1) (0,3) (2) (0,2) (1,2) {35,39,37,6} +[##.#..] (0,2,3,4) (0,2,5) (0,2) (3,5) (0,5) (0,1,2,4) (1) (4,5) {30,21,21,7,18,30} +[.....#.] (1,4,5) (0,1,3) (1,4) (0,1,2,3,4,6) (1,2,6) (2,4,5,6) {193,235,212,193,228,32,212} +[.#..#..##] (2,7) (0,5) (0,1,7) (0,1,3,7) (4,8) (1,2,3,4,5,6,8) (0,1,2,3,4,5,6,8) (1,2,3,5,6,8) (1,7) {193,203,52,54,38,54,38,179,45} +[#..#.#] (3,5) (0,1,2,3,5) (2,4) (0,3,5) (0,1,5) {11,6,9,22,9,28} +[.#.#.##] (0,1) (0,2,3,5,6) (0,2,3,5) (0,1,2,3,5) (0,2,4,5,6) (4,5,6) (1,2) (4,5) {39,25,40,28,4,32,20} +[....##.#..] (0,2,3,4,5,6,7,8,9) (0,3,4,6,7,8,9) (6,7) (1,5) (0,2,3,9) (2,8,9) (1,6,9) (0,1,3,5,6,7,8) {50,39,35,50,17,39,64,47,42,52} +[####.##.] (0,1,2,4) (1,3,5,6) (2) (1,3,6) (0,1,3,7) (0,2,5,6) (0,2,7) (4,7) {49,37,38,21,18,1,7,34} +[.##.###.] (2,4,5,7) (4,5,6,7) (1,3) (0,1,2,7) (0,1,3,4,6,7) (2,5,6,7) (1,2,4,5,6) {20,49,64,12,41,50,34,52} +[.#....] (2) (1,2,3,5) (0,2,3,4,5) (1,3,5) (2,3,4) (1) {14,32,178,172,153,33} +[.####...] (0,1,2,4,6,7) (0,2,3,4,6,7) (1,2,3,6,7) (0,4,5,6,7) (0,1,2,3,5,6,7) (1,2,3,5,6,7) {48,40,58,46,46,33,74,74} +[.#.###.] (0,2,3,4,5,6) (1,2,4,5) (6) (0,1,3,4) (1,2,6) (2,3) (0,5,6) (3,4,6) (1,3,4,5,6) {35,33,58,55,52,40,189} +[#..####.] (1,3,4,5,6,7) (0,1,3,4) (2,4,6) (1,2,3,4,5,7) (0,1,3,4,6,7) (0,3,5,7) (0,1,4,7) {30,55,16,43,62,29,26,44} +[#.#.#..#.#] (0,1,2,3,4,5,7) (3,5) (0,1,2,4,6,7,8,9) (1,2,3,7,8,9) (0,1,6,9) (2,3,4,5,6,9) (1,2,4,9) (5,7) (0,2,8,9) {45,150,171,151,28,42,38,147,150,183} +[..##] (0,2,3) (0,3) (1,2,3) (0,1,3) {202,19,15,213} diff --git a/src/day10/main.rs b/src/day10/main.rs new file mode 100644 index 0000000..ac4b79a --- /dev/null +++ b/src/day10/main.rs @@ -0,0 +1,1140 @@ +use anyhow::{Ok, Result}; +use core::panic; +use rand::seq::{IteratorRandom, SliceRandom}; +use std::{ + collections::{HashMap, HashSet, VecDeque}, + fmt::Debug, + fs, + io::{self, prelude::*}, + ops::RangeInclusive, + u64, vec, +}; + +#[derive(Debug, PartialEq, Eq, Hash)] +struct Machine { + target: u64, + buttons: Vec, + buttons_exp: Vec>, + req: Vec, +} + +type Var = (u64, i64); + +#[derive(Hash, Eq, PartialEq, Clone, Copy)] +enum EqPart { + Num(i64), + Var(u64, i64), + Index(usize), +} + +impl EqPart { + fn is_var(&self) -> bool { + match self { + EqPart::Var(_, _) => true, + _ => false, + } + } + fn to_var(&self) -> Var { + match self { + EqPart::Var(a, b) => (*a, *b), + _ => panic!("unwraping num"), + } + } + fn to_num(&self) -> i64 { + match self { + EqPart::Num(v) => *v, + _ => panic!("unwraping var"), + } + } + fn to_value(&self) -> i64 { + match self { + EqPart::Num(b) => *b, + EqPart::Var(_, b) => *b, + _ => panic!("unwraping num"), + } + } + fn mult(&mut self, m: i64) { + let mut tmp = match self { + EqPart::Num(i) => &mut EqPart::Num(*i * m), + EqPart::Var(idx, i) => &mut EqPart::Var(*idx, *i * m), + EqPart::Index(_) => panic!("un"), + }; + std::mem::swap(self, &mut tmp); + } + fn i_div(&mut self, m: i64) { + let mut tmp = match self { + EqPart::Num(i) => &mut EqPart::Num(*i / m), + EqPart::Var(idx, i) => &mut EqPart::Var(*idx, *i / m), + EqPart::Index(_) => panic!("un"), + }; + std::mem::swap(self, &mut tmp); + } + fn add(&mut self, m: i64) { + let mut tmp = match self { + EqPart::Num(i) => &mut EqPart::Num(*i + m), + EqPart::Var(idx, i) => &mut EqPart::Var(*idx, *i + m), + EqPart::Index(_) => panic!("un"), + }; + std::mem::swap(self, &mut tmp); + } +} + +impl Debug for EqPart { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + EqPart::Num(n) => write!(f, "{}", n), + EqPart::Var(idx, mult) => write!(f, "{}{}", mult, (idx + 97) as u8 as char), + EqPart::Index(idx) => write!(f, "!{}!", idx), + } + } +} + +impl Into for &str { + fn into(self) -> Machine { + let mut niter = self.split("]"); + + let s_target = niter.next().unwrap(); + let mut target = None; + // We want to go in reverse so that the buttons actually mean what they mean + for t in s_target[1..].chars().rev() { + if let Some(p) = target { + target = Some(p << 1 | (t == '#') as u64); + } else { + target = Some((t == '#') as u64); + } + } + + let mut niter = niter.next().unwrap().split("{"); + + let buttons_part = niter.next().unwrap().trim().split(" "); + + let buttons = buttons_part.clone().fold(Vec::new(), |mut s, str| { + let mut b: u64 = 0; + for i in str[1..(str.len() - 1)].split(",") { + let i: usize = i.parse().unwrap(); + b |= 1 << i; + } + s.push(b); + s + }); + + let buttons_exp = buttons_part.fold(Vec::new(), |mut s, str| { + s.push( + str[1..(str.len() - 1)] + .split(",") + .map(|st| st.parse().unwrap()) + .collect(), + ); + s + }); + + let req = niter.next().unwrap(); + let req: Vec = req[..(req.len() - 1)] + .split(",") + .map(|s| s.parse().unwrap()) + .collect(); + + Machine { + target: target.unwrap(), + buttons, + req, + buttons_exp, + } + } +} + +trait Simplyfy { + fn simplfy(&mut self); + fn smart_insert(&mut self, pick: EqPart, other: Vec); + fn get_num(&self) -> Option; + fn get_var(&self, idx: u64) -> Option<(u64, i64)>; + fn pop_num(&mut self) -> Option; +} + +impl Simplyfy for Vec { + fn simplfy(&mut self) { + //println!("simplfing: {:?}", self); + for i in 0..self.len() { + let item = self[i]; + match item { + EqPart::Num(num) => { + if num == 0 { + continue; + } else { + let mut n_num = num; + for j in (i + 1)..self.len() { + let other = self[j]; + match other { + EqPart::Num(n2) => { + n_num = n_num + n2; + std::mem::swap(&mut self[j], &mut EqPart::Num(0)); + } + EqPart::Index(_) => panic!("something wrong"), + _ => (), + } + } + std::mem::swap(&mut self[i], &mut EqPart::Num(n_num)); + } + } + EqPart::Var(idx, mult) => { + if mult == 0 { + continue; + } else { + let mut n_num = mult; + for j in (i + 1)..self.len() { + let other = self[j]; + match other { + EqPart::Num(_) => (), + EqPart::Index(_) => panic!("something wrong"), + EqPart::Var(idx2, mult2) => { + if idx2 == idx { + n_num = n_num + mult2; + std::mem::swap(&mut self[j], &mut EqPart::Num(0)); + } + } + } + } + std::mem::swap(&mut self[i], &mut EqPart::Var(idx, n_num)); + } + } + EqPart::Index(_) => panic!("something is wrong"), + } + } + + let mut new: Vec = self + .clone() + .into_iter() + .filter(|a| match a { + EqPart::Num(n) => *n != 0, + EqPart::Var(_, n) => *n != 0, + EqPart::Index(_) => panic!("something is wrong"), + }) + .collect(); + + // println!("simplified: {:?}", new); + + std::mem::swap(self, &mut new); + } + fn smart_insert(&mut self, pick: EqPart, mut other: Vec) { + let t_idx = match pick { + EqPart::Var(idx, _) => idx, + _ => panic!("un"), + }; + let mut p = None; + for i in 0..self.len() { + if let EqPart::Var(idx, _) = self[i] { + if idx == t_idx { + p = Some(self.remove(i)); + break; + } + } + } + if p.is_none() { + return; + } + if other.len() == 0 { + return; + } + match p.unwrap() { + EqPart::Var(_, mult) => { + if mult != 1 { + for i in 0..other.len() { + other[i] = match other[i] { + EqPart::Num(v) => EqPart::Num(v * mult), + EqPart::Var(idx, v) => EqPart::Var(idx, v * mult), + EqPart::Index(_) => panic!("something is wrong"), + }; + } + } + } + _ => panic!("something is wrong"), + } + self.append(&mut other); + + self.simplfy(); + } + fn get_num(&self) -> Option { + match self + .iter() + .find(|a| if let EqPart::Num(_) = *a { true } else { false }) + { + Some(EqPart::Num(v)) => Some(*v), + _ => None, + } + } + fn get_var(&self, idx: u64) -> Option<(u64, i64)> { + match self.iter().find(|a| { + if let EqPart::Var(v, _) = *a { + *v == idx + } else { + false + } + }) { + Some(EqPart::Var(v, n)) => Some((*v, *n)), + _ => None, + } + } + fn pop_num(&mut self) -> Option { + let i = self.iter().enumerate().fold(None, |o, (i, a)| { + if o.is_some() { + o + } else if !a.is_var() { + Some(i) + } else { + None + } + })?; + let num = self.remove(i); + Some(num.to_num()) + } +} + +trait EqSystem { + fn cleanup(&mut self) -> Option; + fn cleanup_quiet(&mut self, allow_vars: bool) -> Option; + fn apply(&mut self, var: u64, replc: Vec) -> &mut Self; + fn apply_num(&mut self, var: u64, replc: i64) -> &mut Self; + // Return true if success + fn find_1_coe_on_other_side_and_swap(&mut self, k: EqPart) -> bool; +} + +impl EqSystem for HashMap> { + fn cleanup(&mut self) -> Option { + println!("Cleaning up eq sytem"); + let mut new_values = 0; + let mut to_delete = Vec::new(); + for (k, v) in self.iter() { + println!("{:?} = {:?}", k, v); + let idx = match k { + EqPart::Var(idx, _) => idx, + _ => continue, + }; + if v.len() == 1 { + if let EqPart::Num(v) = v[0] { + if v < 0 { + println!("\t Invalid state {}! applying", idx); + return None; + } + println!("\t Found part sol for {}! applying", idx); + to_delete.push(*k); + new_values += v as u64; + } + } else if v.len() == 0 { + println!("\t Found part sol for {} it's 0!", idx); + to_delete.push(*k); + } + } + for i in to_delete { + self.remove(&i); + } + return Some(new_values); + } + + fn cleanup_quiet(&mut self, allow_vars: bool) -> Option { + let mut new_values = 0; + let mut to_delete = Vec::new(); + for (k, v) in self.iter() { + let idx = match k { + EqPart::Var(idx, _) => idx, + EqPart::Num(n) => { + if allow_vars { + continue; + } else { + if *n == v.get_num().unwrap_or(0) && v.len() <= 1 { + to_delete.push(*k); + continue; + } else { + return None; + } + } + } + _ => panic!("eq"), + }; + if v.len() == 1 { + if let EqPart::Num(v) = v[0] { + if v < 0 { + return None; + } + to_delete.push(*k); + new_values += v as u64; + } + } else if v.len() == 0 { + to_delete.push(*k); + } + } + for i in to_delete { + self.remove(&i); + } + return Some(new_values); + } + + fn apply(&mut self, var: u64, replc: Vec) -> &mut Self { + for v in self.values_mut() { + v.smart_insert(EqPart::Var(var, 1), replc.clone()); + } + self + } + + fn apply_num(&mut self, var: u64, replc: i64) -> &mut Self { + for v in self.values_mut() { + if replc == 0 { + v.smart_insert(EqPart::Var(var, 1), Vec::new()); + } else { + v.smart_insert(EqPart::Var(var, 1), vec![EqPart::Num(replc)]); + } + } + self + } + fn find_1_coe_on_other_side_and_swap(&mut self, k: EqPart) -> bool { + let mut k = k.clone(); + let mut cur_options = self.remove(&k).unwrap(); + println!("Chosing var from: {:?} {:?}", cur_options, k); + + let mut pick = None; + for i in 0..cur_options.len() { + if cur_options[i].is_var() { + let (_, b) = cur_options[i].to_var(); + if b == 1 { + pick = Some(cur_options.remove(i)); + break; + } + } + } + + if pick.is_none() { + for i in 0..cur_options.len() { + if cur_options[i].is_var() { + let (_, b) = cur_options[i].to_var(); + if b == -1 { + pick = Some(cur_options.remove(i)); + break; + } + } + } + } + + if pick.is_none() { + // Maybe we didn't fail and we just inline solved it + if let Some(num) = cur_options.get_num() { + if cur_options.len() == 1 && !k.is_var() { + if num == k.to_num() as i64 { + println!("Found inline sol {} for {}", num, k.to_num()); + return true; + } else { + panic!("Something is wrong {} != {:?}", num, k.to_num()) + } + } + } + + // + // Check to see if everyone is div by min + // + let org_cur = cur_options.clone(); + let ork_k = k.clone(); + let vars: Vec = cur_options + .clone() + .into_iter() + .filter(|a| a.is_var()) + .map(|a| a.to_var()) + .collect(); + + let mut min = vars.iter().fold(i64::MAX, |m, (_, c)| m.min(c.abs())); + + if k.is_var() { + min = min.min(k.to_value().abs()); + } else { + if let Some(num) = cur_options.pop_num() { + println!( + "Moving num to other side {:?} - {} = {:?} - {}", + k, num, org_cur, num + ); + k.add(-num); + } + } + + if k.to_value().abs() % min == 0 && vars.iter().all(|(_, v)| v.abs() % min == 0) { + println!( + "Did not find a 1 coe but dound eql divisor for {:?} = {:?} at {}", + k, cur_options, min + ); + k.i_div(min); + self.insert( + k, + cur_options + .into_iter() + .map(|mut a| { + a.i_div(min); + a + }) + .collect(), + ); + if !self.find_1_coe_on_other_side_and_swap(k) { + panic!( + "This is should be impossible becase we div by coe so it's guaranteed at least one!" + ); + } + return true; + } + + self.insert(ork_k, org_cur); + return false; + } + + let pick = pick.unwrap(); + + println!("Picked {:?}", pick); + + let (idx, v) = pick.to_var(); + + // The number we need to multiply the other side + // if the current one is -1 when we move it to the other side + // we don't need to change the original side + let mult = v * -1; + + let mut cur_options: Vec = cur_options + .into_iter() + .map(|mut s| { + s.mult(mult); + s + }) + .collect(); + + // Same logic here + k.mult(mult * -1); + + cur_options.push(k); + cur_options.simplfy(); + + for i in self.values_mut() { + i.smart_insert(pick, cur_options.clone()); + } + + println!("After {:?} = {:?}", EqPart::Var(idx, 1), cur_options); + + self.insert(EqPart::Var(idx, 1), cur_options); + + return true; + } +} + +fn get_presses_for_m(target: &Vec, buttons: &Vec>, i: usize) -> Option { + if i >= buttons.len() { + return None; + } + let button: &Vec = buttons[i].as_ref(); + + let max_can_add = button + .iter() + .fold(u64::MAX, |m, i| m.min(target[*i as usize])); + if max_can_add == 0 { + return get_presses_for_m(target, &buttons, i + 1); + } + for to_remove in (0..=max_can_add).rev() { + let mut n_target = target.clone(); + for i in button.iter() { + n_target[*i as usize] -= to_remove; + } + // println!("max {:?}: {} - {:?}", button, to_remove, n_target); + if n_target.iter().all(|a| *a == 0) { + return Some(to_remove); + } + if let Some(v) = get_presses_for_m(&n_target, &buttons, i + 1) { + return Some(to_remove + v); + } + } + return None; +} + +fn main() -> Result<()> { + let text = fs::read_to_string("src/day10/act.txt")?; + + let mut machines: Vec = text + .split("\n") + .filter(|s| s.len() > 0) + .map(|s| s.into()) + .collect(); + + let mut sol1 = 0; + 'mach: for machine in machines.iter() { + print!("going for machine: {:b} - ", machine.target); + for b in machine.buttons.iter() { + print!("{:b} ", b); + } + println!(""); + + let mut queue: VecDeque<(u64, Vec)> = machine + .buttons + .clone() + .iter() + .enumerate() + .map(|(i, a)| (0 ^ a, vec![i])) + .collect(); + + for (t, _) in queue.iter() { + if *t == machine.target { + println!("Finished machine after 1!!"); + sol1 += 1; + continue 'mach; + } + } + + while let Some((t, c)) = queue.pop_front() { + for (i, b) in machine.buttons.iter().enumerate() { + let t = b ^ t; + let mut nc = c.clone(); + nc.push(i); + // Back at the start + if t == 0 { + continue; + } + if t == machine.target { + println!( + "Finished machine after {:b} {} {:?} {:b}", + machine.target, + c.len() + 1, + nc, + b + ); + sol1 += c.len() + 1; + continue 'mach; + } + queue.push_back((t, nc)); + } + } + } + + println!("Sol1: {}\n\n\n\n\n", sol1); + + let mut sol2_main = 0; + 'machine: for (_i, machine) in machines.iter_mut().enumerate() { + println!( + "\n\n\n\n\n\n\n\n\n\ngoing for machine: {:?} - ", + machine.req + ); + let mut sol2 = 0; + for i in 0..machine.buttons_exp.len() { + println!( + "\tbut: {} {:?}", + (i + 97) as u8 as char, + machine.buttons_exp[i] + ); + } + + let mut hash_t: HashMap> = HashMap::new(); + for (i, _) in machine.req.iter().enumerate() { + hash_t.insert(EqPart::Index(i), Vec::new()); + } + + for (bi, b) in machine.buttons_exp.iter().enumerate() { + for i in b { + hash_t + .get_mut(&EqPart::Index(*i as usize)) + .unwrap() + .push(EqPart::Var(bi as u64, 1)); + } + } + + let mut lines = Vec::new(); + + for i in 0..machine.req.len() { + lines.push(format!( + "{} => {:?} = {:?}", + i, + machine.req[i], + hash_t.get(&EqPart::Index(i)).unwrap() + )); + } + + let mut dup = Vec::new(); + + for i in 0..machine.req.len() { + if lines[i] == "" { + continue; + } + println!("{}", lines[i]); + for j in (i + 1)..machine.req.len() { + if lines[i] == lines[j] { + println!("\tFound dup: {} {}", i, j); + lines[j] = String::from(""); + dup.push(j); + } + } + } + + for d in dup.iter() { + machine.req[*d] = 0; + hash_t.remove(&EqPart::Index(*d)); + machine.buttons_exp = machine + .buttons_exp + .clone() + .into_iter() + .map(|s| { + s.into_iter() + .filter(|s| *s != *d as u64) + .collect::>() + }) + .collect() + } + + // First try + let mut try_later = Vec::new(); + for i in 0..machine.req.len() { + if dup.contains(&i) { + continue; + } + // Get the one based on the index + let cur_options = hash_t.remove(&EqPart::Index(i)).unwrap(); + // Insert the actual value one + let k = EqPart::Num(machine.req[i] as i64); + hash_t.insert(k, cur_options.clone()); + + if !hash_t.find_1_coe_on_other_side_and_swap(k) { + // Restore the index based one + hash_t.remove(&k); + println!("Can not do right now {} {:?}", i, cur_options); + hash_t.insert(EqPart::Index(i), cur_options); + try_later.push(i); + continue; + } + } + + // if try_later.len() >= 1 { + // fn try_later_mult( + // hash_t: &mut HashMap>, + // machine: &Machine, + // try_later: Vec, + // ) -> (u64, Vec) { + // let mut sol2 = hash_t.cleanup().unwrap(); + + // println!("Something failed to get need to try later"); + // for (k, v) in hash_t.iter() { + // println!("{:?} = {:?}", k, v) + // } + + // let mut try_later_2 = Vec::new(); + // 'try_later: for i in try_later { + // // Get the one based on the index + // let cur_options = hash_t.remove(&EqPart::Index(i)).unwrap(); + // // Insert the actual value one + // let k = EqPart::Num(machine.req[i] as i64); + // hash_t.insert(k, cur_options); + + // if !hash_t.find_1_coe_on_other_side_and_swap(k) { + // // removed value based one not to screw with next step + // let cur_options = hash_t.remove(&k).unwrap(); + // hash_t.insert(EqPart::Index(i), cur_options.clone()); + + // // Ok maybe we can swap some things around + // let vars: Vec = cur_options + // .iter() + // .filter(|a| a.is_var()) + // .map(|a| { + // let (idx, _) = a.to_var(); + // idx + // }) + // .collect(); + + // let mut possible_swap = Vec::new(); + + // for (k, v) in hash_t.clone() { + // if k.is_var() { + // let mut count_exact = 0; + // for i in v.iter() { + // if i.is_var() { + // let (_id, c) = i.to_var(); + // if c.abs() == 1 { + // count_exact += 1; + // } + // } + // } + // println!( + // "Trying to find swap on {:?} = {:?} =====> {} {}({:?})", + // k, + // v, + // count_exact, + // vars.len(), + // vars + // ); + // if count_exact >= 1 { + // possible_swap.push(k.clone()); + // } + // } + // } + + // if possible_swap.len() >= 1 { + // println!("We can swap! picking randomly from {:?}", possible_swap); + + // let k = *possible_swap.choose(&mut rand::thread_rng()).unwrap(); + + // if !hash_t.find_1_coe_on_other_side_and_swap(k) { + // panic!("unrechable"); + // } + + // sol2 += hash_t.cleanup().unwrap(); + + // println!("Swapped!"); + // // Get the one based on the index + // let cur_options = hash_t.remove(&EqPart::Index(i)).unwrap(); + // // Insert the actual value one + // let k = EqPart::Num(machine.req[i] as i64); + // hash_t.insert(k, cur_options.clone()); + + // if !hash_t.find_1_coe_on_other_side_and_swap(k) { + // println!( + // "Failed trying later {:?} try_ing one more time even with swap", + // cur_options + // ); + // let cur_options = hash_t.remove(&k).unwrap(); + // hash_t.insert(EqPart::Index(i), cur_options); + // // In this case we don't restore to the index based one + // try_later_2.push(i); + // continue 'try_later; + // } + + // continue 'try_later; + // } + // println!( + // "Failed trying later {:?} try_ing one more time", + // cur_options + // ); + // try_later_2.push(i); + // continue; + // } + // } + + // let mut try_later_3 = Vec::new(); + // if try_later_2.len() > 0 { + // println!("!!!Still some failirues last try!!!"); + // sol2 += hash_t.cleanup().unwrap(); + // for i in try_later_2 { + // let k_org = EqPart::Index(i); + // println!("Trying to find divisors for {:?}", k_org); + // if !k_org.is_var() { + // let mut ops = hash_t.remove(&k_org).unwrap(); + // let org = ops.clone(); + // let num = ops.pop_num().unwrap_or(0); + // let k = machine.req[i] as i64 + -num; + // if ops.len() == 0 && k == 0 { + // println!("Found inline sol for {}", i); + // continue; + // } + // let div = if ops.len() > 1 { + // // + // // Check to see if everyone is div by min + // // + // let vars: Vec = ops + // .clone() + // .into_iter() + // .filter(|a| a.is_var()) + // .map(|a| a.to_var()) + // .collect(); + + // let min = vars.iter().fold(i64::MAX, |m, (_, c)| m.min(c.abs())); + + // if !(k.abs() % min == 0 + // && vars.iter().all(|(_, v)| v.abs() % min == 0)) + // { + // println!( + // "--Could not find eql divisor for {} = {:?}", + // machine.req[i] as i64, org + // ); + // hash_t.insert(EqPart::Index(i), org); + // try_later_3.push(i); + // continue; + // } + + // min + // } else { + // let (_id, v) = ops[0].to_var(); + // if k.abs() % v.abs() != 0 { + // println!( + // "Could not find eql divisor for {} = {:?}", + // machine.req[i], org + // ); + // hash_t.insert(EqPart::Index(i), org); + // try_later_3.push(i); + // continue; + // } + // v.abs() + // }; + + // println!( + // "Found divisor for {:?} => {} = {:?} at {}", + // k_org, machine.req[i], org, div, + // ); + + // let k = k / div; + // let ops: Vec = ops + // .into_iter() + // .map(|mut m| { + // m.i_div(div); + // m + // }) + // .collect(); + + // let k = EqPart::Num(k); + // hash_t.insert(k, ops); + // if !hash_t.find_1_coe_on_other_side_and_swap(k) { + // panic!( + // "this should be impossilbe we kinda of grarantee that there will always a div" + // ); + // } + // } + // } + + // sol2 += hash_t.cleanup().unwrap(); + // } + // return (sol2, try_later_3); + // } + + // let mut loop_c = 1; + // loop { + // let (t_sol2, t2) = try_later_mult(&mut hash_t, &machine, try_later); + // sol2 += t_sol2; + // if t2.len() == 0 { + // break; + // } + // if loop_c % 1000 == 0 { + // println!("Could not simply any fruther"); + // for i in t2 { + // let mut to_r = hash_t.remove(&EqPart::Index(i)).unwrap(); + // let num = to_r.pop_num().unwrap_or(0); + // hash_t.insert(EqPart::Num(machine.req[i] as i64 - num), to_r); + // } + // sol2 += hash_t.cleanup().unwrap(); + // break; + // } + // try_later = t2; + // loop_c += 1; + // } + // } + + for i in try_later { + let mut to_r = hash_t.remove(&EqPart::Index(i)).unwrap(); + let num = to_r.pop_num().unwrap_or(0); + hash_t.insert(EqPart::Num(machine.req[i] as i64 - num), to_r); + } + + sol2 += hash_t.cleanup().unwrap(); + + let vars: HashSet = hash_t.values().fold(HashSet::new(), |s, v| { + v.iter().fold(s, |mut s, p| match p { + EqPart::Var(idx, _) => { + s.insert(*idx); + s + } + _ => s, + }) + }); + + println!("colected vars {:?}", vars); + + // loop { + // let mut cleanup: Vec = Vec::new(); + // 'vars: for v in vars.iter() { + // let mut neg_one_count = 0; + // 'part: for part in hash_t.values() { + // let n = match part + // .iter() + // .find(|a| if let EqPart::Num(_) = *a { true } else { false }) + // { + // Some(EqPart::Num(v)) => v, + // None => &0, + // a => panic!("not sure what to do here {:?} -> {:?}", part, a), + // }; + // let mut other_vars = 0; + // let mut our_found = false; + // for item in part.iter() { + // if let EqPart::Var(idx, v_value) = item { + // if *idx != *v { + // other_vars += 1; + // } else { + // our_found = true; + // // If the value is negative one it does not change the number + // // of clicks so we can remove if all other parts are also right + // if *v_value == -1 { + // if neg_one_count == 0 { + // neg_one_count += 1; + // continue 'part; + // } + // } + // // If the number is positive and our value + // // is negative we can not skip it because this means + // // that we might be able to lower the num + // if *n > 0 && *v_value < 0 { + // println!( + // "cannot clean up {} because number is positive and we are negative", + // (v + 97) as u8 as char + // ); + // continue 'vars; + // } + + // // If the number is negative and our value + // // is positive we can not skip it because this means + // // that we MUST be able to raise the num + // if *n < 0 && *v_value > 0 { + // println!( + // "cannot clean up {} because number is negative and we are positive", + // (v + 97) as u8 as char + // ); + // continue 'vars; + // } + // } + // } + // } + // // If our is not found then we can just skip this part + // if !our_found { + // continue 'part; + // } + // // If one of the other checks did not catch here + // // but we have other vars we cannot really clean it up + // if other_vars > 0 { + // println!( + // "cannot clean up {} because there are other var", + // (v + 97) as u8 as char + // ); + // continue 'vars; + // } + // } + // // If were able pass through all the parts that + // // means we are able to clean up + // println!("Clearning up {}", (v + 97) as u8 as char); + // cleanup.push(*v); + // } + // if cleanup.len() == 0 { + // break; + // } + // for var in cleanup { + // for v in hash_t.values_mut() { + // v.smart_insert(EqPart::Var(var, 1), Vec::new()); + // } + // vars.remove(&var); + // } + // sol2 += hash_t.cleanup().unwrap(); + // } + + if vars.len() == 0 { + println!("finsihed machine with {}", sol2); + sol2_main += sol2; + continue 'machine; + } + + let mut var_ranages = HashMap::new(); + + // Now we collect the ranges that are possible for each var + for v in vars.iter() { + let mut max = 220; + let mut min = 0; + 'part: for part in hash_t.values() { + let n = part.get_num().unwrap_or(0); + let var = part.get_var(*v); + if var.is_none() { + continue 'part; + } + let (idx, var) = var.unwrap(); + + // n is positive and we are negative then + // we can only really go up to the n + if n > 0 && var < 0 && part.len() == 2 { + max = max.min(n / var.abs()); + } + + // n is positive and we are negative and we are the + // only things here + // then we have a min + // println!( + // "h: {} {} {} {}", + // (idx + 97) as u8 as char, + // n, + // var, + // part.len() + // ); + if n < 0 && var > 0 && part.len() == 2 { + min = min.max(((n.abs() as f64) / var as f64).ceil() as i64); + } + } + + var_ranages.insert(*v, min..=max); + } + + println!("Got ranges"); + for (k, v) in var_ranages.iter() { + println!("{} -> {:?}", (k + 97) as u8 as char, v); + } + + fn recurse_with_range( + mut ranges: Vec<(u64, RangeInclusive)>, + eq: HashMap>, + cur: u64, + mut best: u64, + ) -> Option { + if ranges.len() == 0 { + return Some(0); + } + if ranges.len() == 1 { + let (idx, r) = ranges.pop().unwrap(); + // println!("\n\n\ntrying with {}\n\n\n", (idx + 97) as u8 as char); + let mut m_best = u64::MAX; + for i in r { + if cur + i as u64 > best { + continue; + } + let t_eq = eq.clone().apply_num(idx, i).cleanup_quiet(false); + if t_eq.is_none() { + continue; + } + m_best = m_best.min(t_eq.unwrap() + i as u64 + cur); + if m_best < best { + best = m_best; + println!("new best! {}", best); + } + } + + return Some(m_best); + } + let mut ranges = ranges.into_iter(); + let (idx, r) = ranges.next().unwrap(); + let ranges: Vec<(u64, RangeInclusive)> = ranges.collect(); + + // println!("\n\n\ntrying with {} ->\n\n\n", (idx + 97) as u8 as char); + let mut m_best = u64::MAX; + for i in r { + if cur + i as u64 > best { + continue; + } + let mut teq = eq.clone(); + teq.apply_num(idx, i); + let n_teq = teq.cleanup_quiet(true); + if n_teq.is_none() { + continue; + } + let n_v = cur + i as u64 + n_teq.unwrap(); + if let Some(n_best) = recurse_with_range(ranges.clone(), teq, n_v, best) { + m_best = m_best.min(n_best); + if m_best < best { + best = m_best; + println!("new best 2! {}", best); + } + } + } + + if m_best == u64::MAX { + return None; + } + + return Some(m_best); + } + + sol2 += recurse_with_range(var_ranages.into_iter().collect(), hash_t, 0, u64::MAX).unwrap(); + + println!("finsihed machine with {}", sol2); + + sol2_main += sol2; + + // panic!("todo"); + } + + println!("Sol2: {}", sol2_main); + + Ok(()) +} diff --git a/src/day10/test.txt b/src/day10/test.txt new file mode 100644 index 0000000..dd91d7b --- /dev/null +++ b/src/day10/test.txt @@ -0,0 +1,3 @@ +[.##.] (3) (1,3) (2) (2,3) (0,2) (0,1) {3,5,4,7} +[...#.] (0,2,3,4) (2,3) (0,4) (0,1,2) (1,2,3,4) {7,5,12,7,2} +[.###.#] (0,1,2,3,4) (0,3,4) (0,1,2,4,5) (1,2) {10,11,11,5,10,5} diff --git a/src/day9/act.html b/src/day9/act.html index 07470ed..5334513 100644 --- a/src/day9/act.html +++ b/src/day9/act.html @@ -9,17 +9,5 @@ d="M5921 67692 L94901 67692 L94901 50265 L5921 50265" count="1550760868" /> - -