diff --git a/2021/RESULTS.txt b/2021/RESULTS.txt index 9bb95fb..442d1ba 100644 --- a/2021/RESULTS.txt +++ b/2021/RESULTS.txt @@ -277,3 +277,15 @@ aoc-c : res=606484 aoc-c : res=1162571910364852 time: 0:00.19 real, 0.18 user, 0.00 sys context-switch: 17+1, page-faults: 0+973 + +========================================= +================= day24 ================= +========================================= + +aoc-c : res=98998519596997 + time: 0:00.02 real, 0.02 user, 0.00 sys + context-switch: 2+1, page-faults: 0+89 + +aoc-c : res=31521119151421 + time: 0:00.40 real, 0.40 user, 0.00 sys + context-switch: 1+1, page-faults: 0+85 diff --git a/2021/day23/aoc-c.c b/2021/day23/aoc-c.c index 7805ec9..69fcaa8 100644 --- a/2021/day23/aoc-c.c +++ b/2021/day23/aoc-c.c @@ -35,15 +35,25 @@ static const u64 cost[] = { 1, 10, 100, 1000 }; -/* bitboards usage: - * - * +/* * ############# * #abcdefghijk# * ###l#m#n#o### * #p#q#r#s# * ######### * + * From initial position, we can go: + * - to a, b, d, f, h, j, k + * - to destination room if room unlocked + * To unlock a room: + * - Room must be empty or contain only correct amphipods + * + * + * + * From a, b, d, f, h, j, k, we can go only to correct unlocked room + * + * Init: + * from start position * bit 63: a * bit 62: b * bit 61: c @@ -97,7 +107,7 @@ pos_t *pos_zero; static inline u64 get_occupancy(pos_t *pos) { - return pos->amp[0] | pos->amp[1] | pos->amp[2] | pos->amp[3]; + return pos->amp[A] | pos->amp[B] | pos->amp[C] | pos->amp[D]; } /* here we allow mask to be in forbidden places diff --git a/2021/day24/EXAMPLE.txt b/2021/day24/EXAMPLE.txt deleted file mode 100644 index 6b1b0e6..0000000 --- a/2021/day24/EXAMPLE.txt +++ /dev/null @@ -1,11 +0,0 @@ -inp w -add z w -mod z 2 -div w 2 -add y w -mod y 2 -div w 2 -add x w -mod x 2 -div w 2 -mod w 2 diff --git a/2021/day24/EXAMPLE1.txt b/2021/day24/EXAMPLE1.txt deleted file mode 100644 index a41747d..0000000 --- a/2021/day24/EXAMPLE1.txt +++ /dev/null @@ -1,2 +0,0 @@ -inp x -mul x -1 diff --git a/2021/day24/EXAMPLE2.txt b/2021/day24/EXAMPLE2.txt deleted file mode 100644 index ae8792a..0000000 --- a/2021/day24/EXAMPLE2.txt +++ /dev/null @@ -1,4 +0,0 @@ -inp z -inp x -mul z 3 -eql z x diff --git a/2021/day24/README.txt b/2021/day24/README.txt index d5c4c9b..e37a5ce 100644 --- a/2021/day24/README.txt +++ b/2021/day24/README.txt @@ -59,4 +59,11 @@ MONAD imposes additional, mysterious restrictions on model numbers, and legend s To enable as many submarine features as possible, find the largest valid fourteen-digit model number that contains no 0 digits. What is the largest model number accepted by MONAD? -To begin, get your puzzle input. +Your puzzle answer was 98998519596997. +--- Part Two --- + +As the submarine starts booting up things like the Retro Encabulator, you realize that maybe you don't need all these submarine features after all. + +What is the smallest model number accepted by MONAD? + +Your puzzle answer was 31521119151421.