아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Adjusted Average

시간 제한8초메모리 제한1024 MB

요약
n개의 표본과 목표 평균이 주어질 때, 최대 k개(k<=4)의 표본을 제거해 얻을 수 있는 평균이 목표에 가장 가까울 때의 절대 차이를 출력한다.
난이도

보통10점 중 5점

유형
정렬, 조합론, 수학, 완전 탐색
정답자
아직 제출이 없습니다

문제

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 nn, kk, and x‾\overline{x} (2≤n≤15002 \leq n \leq 1500, 1≤k≤41 \leq k \leq 4, k<nk < n, ∣x‾∣≤109\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 nn integers xx (∣x∣≤109\left| x \right| \leq 10^9), representing the samples.

출력

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

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

예제2

  1. 예제 1

    입력
    5 2 2
    1 2 3 100 200
    
    예상 출력
    0
    
  2. 예제 2

    입력
    5 4 -5
    -6 -3 0 6 3
    
    예상 출력
    0.5