#abc315h. Ex - Typical Convolution Problem

Ex - Typical Convolution Problem

Score : 650650 points

问题描述

你已给定一个序列 (A1,A2,,AN)(A_1, A_2, \ldots , A_N)。让我们通过以下公式定义一个序列 (F0,F1,,FN)(F_0, F_1, \ldots , F_N)

  • F0=1F_0 = 1
  • Fn=Ani+j<nFiFjF_n = A_n\displaystyle\sum_{i+j<n}F_iF_j (1nN)(1 \leq n \leq N)

F1,,FNF_1, \ldots , F_N 对于模数 998244353998244353 的结果。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

You are given a sequence (A1,A2,,AN)(A_1, A_2, \ldots , A_N). Let us define a sequence (F0,F1,,FN)(F_0, F_1, \ldots , F_N) by the following formulae.

  • F0=1F_0 = 1
  • Fn=Ani+j<nFiFjF_n = A_n\displaystyle\sum_{i+j<n}F_iF_j (1nN)(1 \leq n \leq N)

Find F1,,FNF_1, \ldots , F_N modulo 998244353998244353.

Constraints

  • 1N2×1051 \leq N \leq 2 \times 10^5
  • 0Ai<9982443530 \leq A_i < 998244353
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

NN

A1A_1 A2A_2 \ldots ANA_N

Output

Print F1,,FNF_1, \ldots , F_N modulo 998244353998244353 in this order, with spaces in between.

Sample Input 1

5
1 2 3 4 5

Sample Output 1

1 6 48 496 6240

F1=A1F0F0=1F_1 = A_1F_0F_0 = 1. F2=A2(F0F0+F0F1+F1F0)=6F_2 = A_2(F_0F_0+F_0F_1+F_1F_0) = 6. Similarly, we find F3=48,F4=496,F5=6240F_3 = 48, F_4 = 496, F_5 = 6240.

Sample Input 2

3
12345 678901 2345678

Sample Output 2

12345 790834943 85679169

update @ 2024/3/10 09:01:27