Codeforces Round 958 (Div. 2) |
---|
Finished |
For an array $$$u_1, u_2, \ldots, u_n$$$, define
You are given three cost arrays: $$$[a_1, a_2, \ldots, a_n]$$$, $$$[b_1, b_2, \ldots, b_n]$$$, and $$$[c_0, c_1, \ldots, c_{n-1}]$$$.
Define the cost of an array that has $$$x$$$ prefix maximums, $$$y$$$ suffix maximums, and $$$z$$$ ascents as $$$a_x\cdot b_y\cdot c_z$$$.
Let the sum of costs of all permutations of $$$1,2,\ldots,n$$$ be $$$f(n)$$$. Find $$$f(1)$$$, $$$f(2)$$$, ..., $$$f(n)$$$ modulo $$$998\,244\,353$$$.
The first line contains an integer $$$n$$$ ($$$1\le n\le 700$$$).
The second line contains $$$n$$$ integers $$$a_1,\ldots,a_n$$$ ($$$0\le a_i<998\,244\,353$$$).
The third line contains $$$n$$$ integers $$$b_1,\ldots,b_n$$$ ($$$0\le b_i<998\,244\,353$$$).
The fourth line contains $$$n$$$ integers $$$c_0,\ldots,c_{n-1}$$$ ($$$0\le c_i<998\,244\,353$$$).
Print $$$n$$$ integers: the $$$i$$$-th one is $$$f(i)$$$ modulo $$$998\,244\,353$$$.
31 1 11 1 11 1 1
1 2 6
31 2 32 3 13 1 2
6 13 34
51 4 2 5 32 5 1 3 4300000000 100000000 500000000 400000000 200000000
600000000 303511294 612289529 324650937 947905622
In the second example:
The sum of all permutations' costs is $$$34$$$, so $$$f(3)=34$$$.
Name |
---|