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

18951번 - Knapsack 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB544416.000%

문제

There are $n$ types of weights. The mass of one weight of type $i+1$ is not less than the mass of two weights of type $i$. You have exactly 2ドル$ weights of each type.

Count the number of ways to select some weights with total mass equal to $W$. Two ways are different if for some $i,ドル the number of selected weights of type $i$ is different.

입력

In the first line of input, there are two integers $n$ and $W$: the number of types and the desired total mass (1ドル \le n \le 60,ドル 0ドル \le W \le 4 \cdot 10^{18}$).

In the second line of input, there are $n$ integers $a_{i}$: the masses of the weights. It is guaranteed that 1ドル \le a_{1},ドル 2ドル \cdot a_{i} \le a_{i+1},ドル and $a_{n} \le 10^{18}$.

출력

Print a single line containing the answer to the problem.

제한

예제 입력 1

5 100
2 5 10 21 49

예제 출력 1

3

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2018 > Day 1: t.me / umnik_team Contest F번

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

출처

대학교 대회

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

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