part1 (2209B)
1--- Day 6: Chronal Coordinates --- 2 3The device on your wrist beeps several times, and once again you feel like you're falling. 4 5"Situation critical," the device announces. "Destination indeterminate. Chronal interference 6detected. Please specify new target coordinates." 7 8The device then produces a list of coordinates (your puzzle input). Are they places it thinks are 9safe or dangerous? It recommends you check manual page 729. The Elves did not give you a manual. 10 11[1m[97mIf they're dangerous,[0m maybe you can minimize the danger by finding the coordinate that gives the 12largest distance from the other points. 13 14Using only the Manhattan distance, determine the [1m[97marea[0m around each coordinate by counting the number 15of integer X,Y locations that are [1m[97mclosest[0m to that coordinate (and aren't [1m[97mtied in distance[0m to any 16other coordinate). 17 18Your goal is to find the size of the [1m[97mlargest area[0m that isn't infinite. For example, consider the 19following list of coordinates: 20 211, 1 221, 6 238, 3 243, 4 255, 5 268, 9 27 28If we name these coordinates A through F, we can draw them on a grid, putting 0,0 at the top left: 29 30.......... 31.A........ 32.......... 33........C. 34...D...... 35.....E.... 36.B........ 37.......... 38.......... 39........F. 40 41This view is partial - the actual grid extends infinitely in all directions. Using the Manhattan 42distance, each location's closest coordinate can be determined, shown here in lowercase: 43 44aaaaa.cccc 45a[1m[97mA[0maaa.cccc 46aaaddecccc 47aadddecc[1m[97mC[0mc 48..d[1m[97mD[0mdeeccc 49bb.de[1m[97mE[0meecc 50b[1m[97mB[0mb.eeee.. 51bbb.eeefff 52bbb.eeffff 53bbb.ffff[1m[97mF[0mf 54 55Locations shown as . are equally far from two or more coordinates, and so they don't count as being 56closest to any. 57 58In this example, the areas of coordinates A, B, C, and F are infinite - while not shown here, their 59areas extend forever outside the visible grid. However, the areas of coordinates D and E are finite: 60D is closest to 9 locations, and E is closest to 17 (both including the coordinate's location 61itself). Therefore, in this example, the size of the largest area is [1m[97m17[0m. 62 63[1m[97mWhat is the size of the largest area[0m that isn't infinite? 64 65