시간 제한메모리 제한제출정답맞힌 사람정답 비율
8 초 (추가 시간 없음) 1024 MB127292730.682%

문제

As a student of the Biology And Probability Course at your university, you have just performed an experiment as part of the practical assignments. However, your results do not look very nice: you had hoped that the average of your samples would be different from what it is now.

To improve your results, you decide to let some of your samples "magically disappear" (i.e., dump them in the waste bin). In order to not raise suspicion with your teacher, you can remove only a few of your samples. How close can you possibly get to your desired average?

입력

The input consists of:

  • One line with three integers $n$, $k$, and $\overline{x}$ ($2 \leq n \leq 1500$, $1 \leq k \leq 4$, $k < n$, $\left| \overline{x} \right| \leq 10^9$), the number of samples, the number of samples that may be removed, and the average you think looks the nicest.
  • One line with $n$ integers $x$ ($\left| x \right| \leq 10^9$), representing the samples.

출력

Output the minimal absolute difference between $\overline{x}$ and the average you can obtain by removing at most $k$ samples from the dataset.

Your answer should have an absolute error of at most $10^{-4}$.

예제 입력 1

5 2 2
1 2 3 100 200

예제 출력 1

0

예제 입력 2

5 4 -5
-6 -3 0 6 3

예제 출력 2

0.5

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2022 A번

  • 문제를 만든 사람: Ludo Pulles