#P10066. [CCO 2023] Binaria
[CCO 2023] Binaria
Problem Description
You have been hired by the Cheap Communication Organization (CCO) to research a breakthrough communication technology: Submessage Sums (SMS). The revolutionary idea is as follows.
Given a binary string of length and a positive integer with , the SMS of the string consists of integers. The first number in the sequence is the sum of the first bits, the second number is the sum of bits through , and so on. The last number is the sum of bits through .
For example, if , then the SMS of the binary string is . This is because , , and .
Since you are a beginner, your job is not to find the original binary string from a given SMS, but to find the number of binary strings that could produce this SMS.
Input Format
The first line contains two integers and , separated by spaces.
The second line contains integers separated by spaces. It is guaranteed that this sequence is the SMS of at least one binary string.
Output Format
Output , where is the positive integer equal to the total number of binary strings that correspond to the given SMS.
7 4
3 2 2 2
3
Hint
Possible strings of length are , , and .
For all testdata, and .
| Subtask ID | Score | Range of | Range of |
|---|---|---|---|
| 1 | 12 | ||
| 2 | None | ||
| 3 | 16 | ||
| 4 | |||
| 5 | |||
| 6 | 28 | None |
Translated by ChatGPT 5