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

19079번 - Lying From You 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
10 초 512 MB184426.667%

문제

You are given $n$ lines on the plane, defined by equations of the form $y = a_i x + b_i$. You can change the coefficients of a line from $(a, b)$ to $(a', b')$ at the cost of $|a - a'| + |b - b'|$ rubles. You can do this operation an arbitrary number of times with arbitrary lines, and the resulting coefficients can be any real numbers. Your goal is to make all the lines share a common point.

Let $C$ be the set of total costs of operations leading to the goal. Find $\inf C,ドル that is, the tight lower bound for the total cost.

입력

The first line contains a positive integer $n$ (1ドル \le n \le 10^5$), the number of lines.

Each of the next $n$ lines contains two integers $a_i$ and $b_i$ ($|a_i|, |b_i| \le 10^6$).

출력

Print the answer on a single line with absolute or relative error no more than 10ドル^{-6}$.

제한

예제 입력 1

3
0 0
1 -1
-1 0

예제 출력 1

0.500000000000000

예제 입력 2

5
4 1
3 0
3 1
2 0
1 2

예제 출력 2

3.000000000000000

힌트

In the first example, it is enough to change $b$ of the first line to $-0.5$.

출처

Camp > Petrozavodsk Programming Camp > Summer 2017 > Day 5: Moscow IPT Contest C번

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

출처

대학교 대회

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

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