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

33024번 - Joy of Pokémon Observation 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 2048 MB21181794.444%

문제

The Pokémon Conservation Society protects Pokémon and their habitats all around the globe. In recent research, data about $h$ habitats was collected.

Each habitat may be inhabited by several Pokémon species. Researchers know how many limbs each species has. Pokémon are swift and extremely good at hiding, so researchers were only able to detect the total number of limbs in each of the habitats.

Researchers understand that it might not be possible to find the population of each species, but would like to understand how much uncertainty is left. How many different combinations of Pokémon would have the observed number of limbs?

입력

The first line contains a single integer $h$ (1ドル \le h \le 1,024円$) --- the number of habitats. The next $h$ lines contain the description of each habitat.

Each line starts with two integers $t$ and $s$ (0ドル \le t \le 10^9,ドル 1ドル \le s \le 3$), where $t$ is the total number of limbs, and $s$ is the number of species in the habitat. They are followed by $s$ integers $l_i$ (1ドル \le l_i \le 16$) --- the number of limbs for each species.

출력

Output the number of possible combinations of Pokémon in each habitat. Output should contain $h$ lines with a single integer.

제한

예제 입력 1

3
6 1 3
6 2 2 3
6 3 1 2 3

예제 출력 1

1
2
7

예제 입력 2

4
1000000000 3 1 1 1
0 3 2 4 5
17 2 2 4
34 3 5 3 2

예제 출력 2

500000001500000001
1
0
25

힌트

출처

ICPC > Regionals > Northern Eurasia > Northern Eurasia Finals > Northern Eurasia Finals 2023 J번

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

출처

대학교 대회

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

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