F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Find the Number of Paths

Time Limit: 16000/8000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 221    Accepted Submission(s): 59


Problem Description
Huah has $n+k$ cities numbered $1,2,.... ,n+k$, the city $i(1\le i< n+k)$ to the city $i+1$ has $n+k-i$ distinct one-way roads.

For each $x=1,2,...,n-1$,the city $i(x< i\le n+k)$ to the city $i-x$ has $a_x$ distinct one-way roads.

For $m=k+1,k+2,... ,k+n$,find the number of paths from city $k+1$ to city $m$ that pass through exactly $k$ number of roads.

Two paths are distinct when and only if the sequence of edges they pass through is distinct and the answer is modulo $998244353$.
 

Input
First line has one integer $T(1\le T\le 14)$, indicating there are $T$ test cases. In each case:

First line input two integers $n,k(2\le n\le 2\times 10^5,1\le k\le 2\times 10^5)$.

Second line $n-1$ integers $a_1,a_2,... ,a_{n-1}(0\le a_i\le 998244352)$.

There is a blank line between case $i(1\le i< T)$ and case $i+1$.

Input guarantee $\sum (n+k) \le 1006769$.
 

Output
In each case, output a row of $n$ integers with the $i$-th integer being the answer when $m=k+i$.
 

Sample Input
4 3 2 1 2 3 1 1 2 5 10 2 3 3 3 3 3 166374059 748683265
 

Sample Output
5 0 2 0 2 0 114307026 825469567 425461680 73846080 5140800 5 2 0
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-20 17:39:44, Gzip enabled