CF1336E2.Chiori and Doll Picking (hard version)

NOI/NOI+/CTSC

通过率:0%

时间限制:3.00s

内存限制:512MB

AC君温馨提醒

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

题目描述

This is the hard version of the problem. The only difference between easy and hard versions is the constraint of mm. You can make hacks only if both versions are solved.

Chiori loves dolls and now she is going to decorate her bedroom!

As a doll collector, Chiori has got nn dolls. The ii-th doll has a non-negative integer value aia_i (ai<2ma_i \lt 2^m, mm is given). Chiori wants to pick some (maybe zero) dolls for the decoration, so there are 2n2^n different picking ways.

Let xx be the bitwise-xor-sum of values of dolls Chiori picks (in case Chiori picks no dolls x=0x = 0). The value of this picking way is equal to the number of 11-bits in the binary representation of xx. More formally, it is also equal to the number of indices 0≤i<m0 \leq i \lt m, such that ⌊x2i⌋\left\lfloor \frac{x}{2^i} \right\rfloor is odd.

Tell her the number of picking ways with value ii for each integer ii from 00 to mm. Due to the answers can be very huge, print them by modulo 998 244 353998\,244\,353.

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

千织喜爱玩偶,现在她准备装饰自己的卧室!

作为一名玩偶收藏家,千织拥有 nn 个玩偶。第 ii 个玩偶具有一个非负整数值 aia_i(满足 ai<2ma_i \lt 2^m,其中 mm 已给出)。千织打算从中选出若干个(可能为零个)玩偶用于装饰,因此共有 2n2^n 种不同的选取方式。

令 xx 表示千织所选玩偶之值的按位异或和(若未选任何玩偶,则 x=0x = 0)。该选取方式的价值定义为 xx 的二进制表示中 11 的个数。更形式化地,它也等于满足 ⌊x2i⌋\left\lfloor \frac{x}{2^i} \right\rfloor 为奇数的所有下标 0≤i<m0 \leq i \lt m 的个数。

请为每个整数 ii(从 00 到 mm)输出价值恰好为 ii 的选取方式数目。由于答案可能非常大,请对 998 244 353998\,244\,353 取模后输出。

输入格式

The first line contains two integers nn and mm (1≤n≤2⋅1051 \le n \le 2 \cdot 10^5, 0≤m≤530 \le m \le 53) — the number of dolls and the maximum value of the picking way.

The second line contains nn integers a1,a2,…,ana_1, a_2, \ldots, a_n (0≤ai<2m0 \le a_i \lt 2^m) — the values of dolls.

第一行包含两个整数 nn 和 mm(1≤n≤2⋅1051 \le n \le 2 \cdot 10^5,0≤m≤530 \le m \le 53)—— 分别表示玩偶的数量以及选取方式的最大值。

第二行包含 nn 个整数 a1,a2,…,ana_1, a_2, \ldots, a_n(0≤ai<2m0 \le a_i \lt 2^m)—— 表示各个玩偶的值。

输出格式

Print m+1m+1 integers p0,p1,…,pmp_0, p_1, \ldots, p_m — pip_i is equal to the number of picking ways with value ii by modulo 998 244 353998\,244\,353.

输出 m+1m+1 个整数 p0,p1,…,pmp_0, p_1, \ldots, p_m — 其中 pip_i 表示价值恰好为 ii 的选取方案数,对 998 244 353998\,244\,353 取模。

输入输出样例

  • 输入#1

    4 4
    3 5 8 14

    输出#1

    2 2 6 6 0
  • 输入#2

    6 7
    11 45 14 9 19 81

    输出#2

    1 2 11 20 15 10 5 0

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

首页