day 24
This commit is contained in:
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
@@ -1,2 +0,0 @@
|
||||
inp x
|
||||
mul x -1
|
@@ -1,4 +0,0 @@
|
||||
inp z
|
||||
inp x
|
||||
mul z 3
|
||||
eql z x
|
@@ -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.
|
||||
|
Reference in New Issue
Block a user