Hull Edge Energy
Build the convex hull and print the sum of the SQUARED lengths of its edges (an integer, avoiding floating point). A hull of fewer than 2 vertices has energy 0.
Input: the first line has N; the next N lines have distinct points x y.
Output: the sum of squared hull-edge lengths.
Constraints:
- 1 ≤ N ≤ 105
- |coordinates| ≤ 106
Sample Tests
Input 1
4 0 0 3 0 3 4 0 4
Output 1
50
Input 2
2 0 0 1 1
Output 2
4
Discussion (opens after you solve — no spoilers before)
No comments yet.