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

26491번 - NiceSet 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB148861.538%

문제

The Great Kagura loves the number $S$. In front of her, she has a sequence of integers $a_1, \dots , a_n$. She wants to select a collection of these integers such that the sum of the absolute values of the differences of all pairs of integers in her collection is at most $S$. For example, if her collection is $x,ドル $y,ドル $z,ドル then $|x − y| + |x − z| + |y − z| ≤ S$. She wants to select the largest collection that she can. Can you help her?

입력

The first line of the input contains the two integers $n$ and $S$. The second line of the input contains $a_1, \dots , a_n$.

출력

Output the size of the largest collection of integers from among $a_1, \dots , a_n$ that satisfy the required condition.

제한

  • 1ドル ≤ n ≤ 300,000円$
  • 1ドル ≤ a_i ≤ 1,000円,000円,000円$
  • 1ドル ≤ S ≤ 10^{18}$

서브태스크

번호배점제한
16

$a_i = 1$

27

$a_i ∈ \{1, 2\}$

38

$a_i = i$

49

$n ≤ 20,ドル $a_i ≤ 1,000円,ドル $S ≤ 1,000円,000円,000円$

521

$n ≤ 100,ドル $S ≤ 1,000円,000円,000円$

618

$n ≤ 2000,ドル $S ≤ 1,000円,000円,000円$

731

No further restrictions.

예제 입력 1

5 3
1 2 3 4 5

예제 출력 1

2

One possible collection is 1ドル,ドル 2ドル$. All collections with 3ドル$ elements have the sum of absolute differences at least 4ドル$.

예제 입력 2

5 4
1 2 3 4 5

예제 출력 2

3

One possible collection is 1ドル,ドル 2ドル,ドル 3ドル$.

예제 입력 3

5 1
1 1 1 1 1

예제 출력 3

5

The entire sequence is a valid collection.

예제 입력 4

10 7
1 5 3 2 4 3 1 3 2 100

예제 출력 4

5

One possible collection is 2ドル,ドル 2ドル,ドル 3ドル,ドル 3ドル,ドル 3ドル$.

힌트

출처

Contest > infO(1) Cup > infO(1) Cup 2022 C번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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