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

19344번 - Statistics 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1.5 초 256 MB92266.667%

문제

It is time to select courses for your last semester of university. There are $N$ courses available, numbered from 1ドル$ through $N$. Course $i$ is worth $v_i$ units, and you need at least $V$ units to graduate. Because you want more time to train for ACM ICPC, you want to choose a subset of courses that gives exactly $V$ units. Also, you want to choose the least number of courses possible to minimize the amount of time spent walking around campus. You call such a subset a good schedule.

You are having trouble choosing among all possible good schedules, so you turn to statistics for help. For each good schedule, viewing it as a list of the units of its courses, you calculate:

  • $a,ドル the average value.
  • $b,ドル the median value. (In case the list's length is even, use the smaller of the two middle values.)
  • $c,ドル the maximum number of times a single value appears.
  • $d,ドル the difference between the maximum value and the minimum value.

For each of $a,ドル $b,ドル $c,ドル and $d,ドル find its minimum over all good schedules.

입력

The first line contains two integers, $N$ and $V$: the number of courses and the number of units you need to graduate (1ドル \leq N, V \leq 5000$).

The next line contains $N$ integers $v_1, v_2, \ldots, v_N,ドル the number of units in each of the available courses (1ドル \leq v_i \leq V$).

출력

Print out four space-separated real numbers: the minimum $a,ドル $b,ドル $c,ドル and $d$ over all good schedules, in that order. If there are no good schedules, print a single integer $-1$ instead. Your answer must have an absolute or relative error less than 10ドル^{-6}$.

제한

예제 입력 1

6 15
6 1 13 5 4 1

예제 출력 1

5.000000000 1 1 2

예제 입력 2

3 7
3 1 2

예제 출력 2

-1

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2018 > Day 9: Carnegie Mellon U Contest I번

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

출처

대학교 대회

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

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