Problem 4

[Back]

You find which rooms the elves are in, find all of the elves (well, the ones that hadn't already found their way back), and leave the building. You then get lost navigating the campus, and end up at what appears to be some sports fields (abandoned, like everywhere else you've encountered), where the elves are apparently trying to deliver 60 eggs to a central point to make eggnog.

The elves' delivery strategy is not perfect. For one, they seem to be only delivering one egg at once. Also, they seem already to have drunk some of the eggnog; their drunken maneuvering means that the time it'll take to get an egg to the central point, in minutes, is the square of the distance to the central point.

You make a map that displays the locations of the eggs, with e representing an egg, c representing the central point (which is not guaranteed to be at the center; perhaps the eggnog had something to do with this, too), and . representing nothing. You want to determine how many minutes it will take the elves to deliver all 60 eggs.

For example, if your input were:
...e...
.......
e...e..
.......
.......
.......
ec.....
then there would be only 4 eggs, and their squared distances to the center point would be 40, 17, 25, and 1, leading to the output of 83 total minutes.

To begin, get your problem input. You feel that this problem will take 6 lines of code.

Answer: [Submit]