Problem N
Who Watches the Watchmen?
There are some sentry drones guarding a top-secret facility. Each sentry is stationary at some point in 3D space, and faces in some viewing direction.
With recent advances in artificial intelligence, the owners of the facility have come to the realization that the greatest threats to the facility are not intruders, but the sentries themselves! For security, they want to adjust the sentries such that every sentry is watching another sentry and every sentry is seen by exactly one other sentry.
It costs
A sentry at location
Input
The first line of input contains a single integer
Each of the next
Output
Output a single integer, which is the minimum amount of
energy needed to reposition the sentries so that each sentry
can be seen by exactly one other sentry, or
Sample Input 1 | Sample Output 1 |
---|---|
4 66 45 10 73 39 36 95 14 26 47 84 59 14 66 89 89 36 78 16 27 94 79 24 24 |
4 |