#P3773. [CTSC2017] 吉夫特
[CTSC2017] 吉夫特
Description
A simple problem, both a gift and a poison.
B designed a simple problem to give as a "gift" to everyone.
Given a sequence of length , , ask how many non-increasing subsequences of length at least satisfy:
$$\prod _{i=2}^{k} \binom{a_{b_{i-1}}}{a_{b_i}} \bmod 2 = \binom{a_{b_1}}{a_{b_2}} \times \binom{a_{b_2}}{a_{b_3}} \times \cdots \binom{a_{b_{k-1}}}{a_{b_k}} \bmod 2 > 0$$Output this count modulo .
G, after seeing the problem, explained some basic concepts for everyone.
We choose any number of integers satisfying
We call a subsequence of .
If this subsequence also satisfies
$$a_{b_1} \geq a_{b_2} \geq \cdots \geq a_{b_{k-1}}\geq a_{b_k}$$we call the subsequence non-increasing.
The binomial coefficient is the number of ways to choose elements from distinct elements, computed as follows:
$$\binom {n}{m}=\frac{n!}{m!(n-m)!}=\frac{n \times (n-1) \times \cdots \times 2 \times 1}{(m \times (m-1) \cdots \times 2 \times 1)((n-m)\times(n-m-1)\times \cdots \times 2 \times 1)}$$Note in particular that since we only consider non-increasing subsequences, it must hold during binomial computation that , i.e., in we always have .
We emphasize the definition of : $x \bmod y = x -\left \lfloor \frac{x}{y} \right \rfloor \times y$ where denotes the greatest integer less than or equal to .
means that is odd.
Meanwhile, experience tells us that a sequence of length has subsequences, so we take the answer modulo to avoid an overly large output.
B felt that G’s points were very reasonable and reiterated these basics.
Finally, upon hearing that this problem is a "gift" to everyone, G had a piece of advice.
“Vorsicht, Gift!”
“Careful... highly toxic!”
Input Format
The first line contains an integer .
Then follow lines, each containing one integer. The -th of these lines is .
Output Format
Output a single integer, the answer.
4
15
7
3
1
11
Hint
For the first of the test points, , .
For the first of the test points, , .
For the first of the test points, , .
For the first of the test points, .
For the first of the test points, .
For of the test points, , . All are pairwise distinct, that is, there do not exist such that and .
Translated by ChatGPT 5
京公网安备 11011102002149号