QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 1024 MB Total points: 100 Hackable ✓

#618. 多项式乘法

統計

题目描述

给定 $n$ 次多项式 $A(z)=\sum^n_{i=0} a_iz^i$ 与 $m$ 次多项式 $B(z)=\sum^n_{i=0} b_iz^i$,求它们的乘积 $C(z) = \sum^{n+m}_{i=0} c_iz^i$,对 998244353 取模。

输入格式

输入的第一行包含两个整数 $n,m$。

接下来一行,包含 $n + 1$ 个整数 $a_0,a_1,\cdots,a_n$。

接下来一行,包含 $m + 1$ 个整数 $b_0,b_1,\cdots,b_m$。

输出格式

输出一行 $n+m+1$ 个整数,表示 $c_0,c_1,\cdots,c_{n+m}$。

样例数据

样例输入

2 3
1 2 3
3 4 5 6

样例输出

3 10 22 28 27 18

子任务

对于所有数据,$1 \leq n,m \leq 10^6$,$0 \le a_i, b_i < 998\,244\,353$。

子任务 $n,m\leq$
$1$ $100$
$2$ $5 \times 10^3$
$3$ $3 \times 10^4$
$4$ $10^5$
$5$ $10^6$
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.