#P7720. 「EZEC-10」「Byakkai OI 2021」Estahv
「EZEC-10」「Byakkai OI 2021」Estahv
Description
We have infinitely many cells in a row, numbered from left to right as .
You may fill any positive integer into each cell, and then you obtain the weight .
Here, , and .
The total weight of several cells is defined as the product of their weights.
Now you need to fill numbers into the cells from left to right, until the sum of the filled numbers becomes equal to or exceeds .
After that, you need to color each filled cell either black or white, satisfying: there do not exist any or more consecutive white cells, the first cell must be black, and the last filled cell must be white.
Then, you need to add an edge between every pair of adjacent filled cells that have the same color, and select a set of cells such that any two cells in are not connected by an edge (it can be empty).
The weight of a plan is defined as the total weight of all cells.
Given , for , compute the sum of weights over all plans that complete all operations above, such that the sum of the filled numbers is exactly , and the number of black cells is .
Two plans are different if and only if the number of filled cells is different, or the numbers filled in the corresponding cells are different, or the colors of the corresponding cells are different, or the set is different.
Take the result modulo .
Input Format
The first line contains one positive integer .
Output Format
Output one line with non-negative integers, representing the answers for .
3
0 16 6 0
8
0 8008 24388 29840 16788 4360 476 16 0
Hint
[Explanation of Sample .]
When , there can be or cells.
If there are cells, the filling plans are or , and the total weight is ; the coloring plan is BW, so there must be one black cell; the choices of the set are (cells are indexed by their numbers).
If there are cells, the filling plan is , and the weight is ; the coloring plan is BBW, so there must be two black cells; the choices of the set are (cells are indexed by their numbers).
Here, B means black and W means white.
[Constraints.]
This problem uses bundled tests.
- Subtask 1 (30 points): .
- Subtask 2 (20 points): .
- Subtask 3 (20 points): .
- Subtask 4 (30 points): no special constraints, time limit is .
For of the testdata, .
Hint
To make it easier for everyone to get points with brute force, here is the result:
$$C_k = \frac1k \binom{2k}{k-1} = \binom{2k-1}{k-1}-\binom{2k-1}{k-2}$$Translated by ChatGPT 5
京公网安备 11011102002149号