CF1916H2.Matrix Rank (Hard Version)

省选/NOI-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

This is the hard version of the problem. The only differences between the two versions of this problem are the constraints on kk. You can make hacks only if all versions of the problem are solved.

You are given integers nn, pp and kk. pp is guaranteed to be a prime number.

For each rr from 00 to kk, find the number of n×nn \times n matrices AA of the field†^\dagger of integers modulo pp such that the rank‡^\ddagger of AA is exactly rr. Since these values are big, you are only required to output them modulo 998 244 353998\,244\,353.

†^\dagger https://en.wikipedia.org/wiki/Field_(mathematics)

‡^\ddagger https://en.wikipedia.org/wiki/Rank_(linear_algebra)

这是该问题的困难版本。两个版本的唯一区别在于对 kk 的约束条件。只有当该问题的所有版本均被解决后,才允许进行 hack。

给定整数 nn、pp 和 kk。其中 pp 保证为质数。

对每个从 00 到 kk 的 rr,求满足以下条件的 n×nn \times n 矩阵 AA 的个数:矩阵 AA 的元素取自模 pp 的整数域†^\dagger,且 AA 的秩‡^\ddagger 恰好为 rr。由于答案可能很大,你只需输出结果对 998 244 353998\,244\,353 取模后的值。

†^\dagger https://en.wikipedia.org/wiki/Field_(mathematics)

‡^\ddagger https://en.wikipedia.org/wiki/Rank_(linear_algebra)

输入格式

The first line of input contains three integers nn, pp and kk (1≤n≤10181 \leq n \leq 10^{18}, 2≤p<998 244 3532 \leq p \lt 998\,244\,353, 0≤k≤5⋅1050 \leq k \leq 5 \cdot 10^5).

It is guaranteed that pp is a prime number.

输入的第一行包含三个整数 nn、pp 和 kk(1≤n≤10181 \leq n \leq 10^{18},2≤p<998 244 3532 \leq p \lt 998\,244\,353,0≤k≤5⋅1050 \leq k \leq 5 \cdot 10^5)。

保证 pp 是一个质数。

输出格式

Output k+1k+1 integers, the answers for each rr from 00 to kk.

输出 k+1k+1 个整数,分别对应 rr 从 00 到 kk 的每个答案。

输入输出样例

  • 输入#1

    3 2 3

    输出#1

    1 49 294 168
  • 输入#2

    1 51549919 2

    输出#2

    1 51549918 0

输入解题思路,AI测评打分。不知道怎么写?

首页