Logo
(追記) (追記ここまで)

21181번 - Kangaroo Party 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB13812110989.344%

문제

A group of kangaroos live in houses on the number line. They all want to watch the Kangaroo Bowl!

Because not all of the kangaroos can fit a single house, they will designate two kangaroos to each host a party at their house. All other kangaroos will choose to go to the house that is closest to them, picking arbitrarily if they are the same distance from both.

A kangaroo expends $(a - b)^2$ units of energy to travel from location $a$ to location $b$. Compute the minimum total units of energy expended if the two party house locations are chosen optimally.

입력

The first line of input contains a single integer $n$ (2ドル \le n \le 50$), which is the number of kangaroos.

Each of the next $n$ lines contains a single integer $x$ ($-1,000 \le x \le 1,000$), which is the location on the number line of the house of one of the kangaroos. Each location will be distinct.

출력

Output, on a single line, the minimum total units of energy expended by all the kangaroos, given that the party house locations are chosen optimally.

제한

예제 입력 1

5
0
3
-3
10
11

예제 출력 1

19

힌트

출처

ICPC > Regionals > North America > Pacific Northwest Regional > 2020 ICPC Pacific Northwest Region > Division 2 AE번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /