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
65
|
--- Day 6: Chronal Coordinates ---
The device on your wrist beeps several times, and once again you feel like you're falling.
"Situation critical," the device announces. "Destination indeterminate. Chronal interference
detected. Please specify new target coordinates."
The device then produces a list of coordinates (your puzzle input). Are they places it thinks are
safe or dangerous? It recommends you check manual page 729. The Elves did not give you a manual.
[1m[97mIf they're dangerous,[0m maybe you can minimize the danger by finding the coordinate that gives the
largest distance from the other points.
Using only the Manhattan distance, determine the [1m[97marea[0m around each coordinate by counting the number
of integer X,Y locations that are [1m[97mclosest[0m to that coordinate (and aren't [1m[97mtied in distance[0m to any
other coordinate).
Your goal is to find the size of the [1m[97mlargest area[0m that isn't infinite. For example, consider the
following list of coordinates:
1, 1
1, 6
8, 3
3, 4
5, 5
8, 9
If we name these coordinates A through F, we can draw them on a grid, putting 0,0 at the top left:
..........
.A........
..........
........C.
...D......
.....E....
.B........
..........
..........
........F.
This view is partial - the actual grid extends infinitely in all directions. Using the Manhattan
distance, each location's closest coordinate can be determined, shown here in lowercase:
aaaaa.cccc
a[1m[97mA[0maaa.cccc
aaaddecccc
aadddecc[1m[97mC[0mc
..d[1m[97mD[0mdeeccc
bb.de[1m[97mE[0meecc
b[1m[97mB[0mb.eeee..
bbb.eeefff
bbb.eeffff
bbb.ffff[1m[97mF[0mf
Locations shown as . are equally far from two or more coordinates, and so they don't count as being
closest to any.
In this example, the areas of coordinates A, B, C, and F are infinite - while not shown here, their
areas extend forever outside the visible grid. However, the areas of coordinates D and E are finite:
D is closest to 9 locations, and E is closest to 17 (both including the coordinate's location
itself). Therefore, in this example, the size of the largest area is [1m[97m17[0m.
[1m[97mWhat is the size of the largest area[0m that isn't infinite?
|