1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
--- Day 23: Experimental Emergency Teleportation ---
Using your torch to search the darkness of the rocky cavern, you finally locate the man's friend: a
small [1m[97mreindeer[0m.
You're not sure how it got so far in this cave. It looks sick - too sick to walk - and too heavy
for you to carry all the way back. Sleighs won't be invented for another 1500 years, of course.
The only option is [1m[97mexperimental emergency teleportation[0m.
You hit the "experimental emergency teleportation" button on the device and push [1m[97mI accept the
risk[0m on no fewer than 18 different warning messages. Immediately, the device deploys hundreds of
tiny [1m[97mnanobots[0m which fly around the cavern, apparently assembling themselves into a very specific
[1m[97mformation[0m. The device lists the X,Y,Z position (pos) for each nanobot as well as its [1m[97msignal
radius[0m (r) on its tiny screen (your puzzle input).
Each nanobot can transmit signals to any integer coordinate which is a distance away from it
[1m[97mless than or equal to[0m its signal radius (as measured by Manhattan distance). Coordinates a distance
away of less than or equal to a nanobot's signal radius are said to be [1m[97min range[0m of that nanobot.
Before you start the teleportation process, you should determine which nanobot is the
[1m[97mstrongest[0m (that is, which has the largest signal radius) and then, for that nanobot, the
[1m[97mtotal number of nanobots that are in range[0m of it, [1m[97mincluding itself[0m.
For example, given the following nanobots:
pos=<0,0,0>, r=4
pos=<1,0,0>, r=1
pos=<4,0,0>, r=3
pos=<0,2,0>, r=1
pos=<0,5,0>, r=3
pos=<0,0,3>, r=1
pos=<1,1,1>, r=1
pos=<1,1,2>, r=1
pos=<1,3,1>, r=1
The strongest nanobot is the first one (position 0,0,0) because its signal radius, 4 is the largest.
Using that nanobot's location and signal radius, the following nanobots are in or out of range:
- The nanobot at 0,0,0 is distance 0 away, and so it is [1m[97min range[0m.
- The nanobot at 1,0,0 is distance 1 away, and so it is [1m[97min range[0m.
- The nanobot at 4,0,0 is distance 4 away, and so it is [1m[97min range[0m.
- The nanobot at 0,2,0 is distance 2 away, and so it is [1m[97min range[0m.
- The nanobot at 0,5,0 is distance 5 away, and so it is [1m[97mnot[0m in range.
- The nanobot at 0,0,3 is distance 3 away, and so it is [1m[97min range[0m.
- The nanobot at 1,1,1 is distance 3 away, and so it is [1m[97min range[0m.
- The nanobot at 1,1,2 is distance 4 away, and so it is [1m[97min range[0m.
- The nanobot at 1,3,1 is distance 5 away, and so it is [1m[97mnot[0m in range.
In this example, in total, [1m[97m7[0m nanobots are in range of the nanobot with the largest signal radius.
Find the nanobot with the largest signal radius. [1m[97mHow many nanobots are in range[0m of its signals?
|