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

26108번 - Linear Regression 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 1024 MB4198696.164%

문제

Chansu is a graduate student at University of ICPC, working in a laboratory for his master’s degree. His research theme is to reveal a relation between the obesity and the yearly income of individuals in a certain group $G$.

Chansu collected data of the form $(x_i, y_i)$ from $n$ persons in $G,ドル where $x_i$ and $y_i$ denote the obesity index and the yearly income of the $i$-th person, and made an apparent hypothesis:

There is a linear dependency between the obesity and the yearly income of individuals in group $G$.

To prove his hypothesis, Chansu tried to find an optimal linear function $f^*(x)$ with real coefficients such that the error with respect to the collected data is minimized. More specifically, the error of $f$ with respect to the data is defined to be the maximum of $|y_i - f(x_i)|$ over all $i = 1, \dots , n$.

However, the result was disappointing because the error of the optimal function $f^*(x)$ was unexpectedly big. This means that his hypothesis cannot be proven in this way.

Chansu tried to figure out the reason of the big errors. One day, he plotted the data $(x_i, y_i)$ as points on the coordinated plane and realized that there are a small number $k$ of points that are unusually far from the others, so the error of the optimal function can be drastically reduced after removing them.

You, as a friend of Chansu, would love to help Chansu. Write a program that finds an optimal linear function minimizing the error after removing some $k$ values from the given data $\{(x_1, y_1), \dots , (x_n, y_n)\}$ and prints out the error value, when the number $k$ is given as part of input.

입력

Your program is to read from standard input. The input starts with a line containing two integers, $n$ and $k$ (1ドル ≤ n ≤ 50,000円,ドル 0ドル ≤ k ≤ \min{\{\frac{n}{2}, 300\}}$), where nn is the number of collected data values. In each of the following $n$ lines, each data value $(x_i, y_i)$ is given by two integers $x_i$ and $y_i$ ($-10^9 ≤ x_i, y_i ≤ 10^9$) for $i = 1, \dots , n$. You can assume that no three of them are collinear when plotting them in the coordinated plane.

출력

Your program is to write to standard output. Print exactly one line. The line should contain a real number $z$ representing the minimum possible error of a linear function with respect to the data after removing some $k$ values. Your output $z$ should be in the format that consists of its integer part, a decimal point, and its fractional part, and will be decided to be “correct” if it holds that $a - 10^{-6} < z < a + 10^{-6},ドル where $a$ denotes the exact answer.

제한

예제 입력 1

6 0
0 0
5 -1
9 6
3 0
4 2
3 1

예제 출력 1

2.166667

예제 입력 2

6 1
0 0
5 -1
9 6
3 0
4 2
3 1

예제 출력 2

1.000000

예제 입력 3

6 2
0 0
5 -1
9 6
3 0
4 2
3 1

예제 출력 3

0.500000

예제 입력 4

6 3
0 0
5 -1
9 6
3 0
4 2
3 1

예제 출력 4

0.083333

힌트

출처

ICPC > Regionals > Asia Pacific > Korea > Asia Regional - Seoul 2022 G번

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

출처

대학교 대회

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

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