CF1408I.Bitwise Magic

NOI/NOI+/CTSC

通过率:0%

时间限制:6.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

You are given a positive integer kk and an array a1,a2,…,ana_1, a_2, \ldots, a_n of non-negative distinct integers not smaller than kk and not greater than 2c−12^c-1.

In each of the next kk seconds, one element is chosen randomly equiprobably out of all nn elements and decreased by 11.

For each integer xx, 0≤x≤2c−10 \leq x \leq 2^c - 1, you need to find the probability that in the end the bitwise XOR of all elements of the array is equal to xx.

Each of these values can be represented as an irreducible fraction pq\frac{p}{q}, and you need to find the value of p⋅q−1p \cdot q^{-1} modulo 998 244 353998\,244\,353.

给你一个正整数 kk 和一个长度为 nn 的数组 a1,a2,…,ana_1, a_2, \ldots, a_n,其中每个元素均为非负互异的整数,且满足 k≤ai≤2c−1k \leq a_i \leq 2^c-1。

接下来的 kk 秒内,每一秒都会从这 nn 个元素中等概率随机选择一个元素,并将其值减 11。

对于每个整数 xx(0≤x≤2c−10 \leq x \leq 2^c - 1),你需要计算:经过上述 kk 次操作后,数组所有元素的按位异或(bitwise XOR)结果恰好等于 xx 的概率。

每个概率均可表示为最简分数 pq\frac{p}{q},你需输出 p⋅q−1 mod 998 244 353p \cdot q^{-1} \bmod 998\,244\,353。

输入格式

The first line of input contains three integers n,k,cn, k, c (1≤n≤(2c−k)1 \leq n \leq (2^c - k), 1≤k≤161 \leq k \leq 16, 1≤c≤161 \leq c \leq 16).

The second line contains nn distinct integers a1,a2,…,ana_1, a_2, \ldots, a_n (k≤ai≤2c−1k \leq a_i \leq 2^c-1).

输入的第一行包含三个整数 n,k,cn, k, c(1≤n≤(2c−k)1 \leq n \leq (2^c - k),1≤k≤161 \leq k \leq 16,1≤c≤161 \leq c \leq 16)。

第二行包含 nn 个互不相同的整数 a1,a2,…,ana_1, a_2, \ldots, a_n(k≤ai≤2c−1k \leq a_i \leq 2^c-1)。

输出格式

Print 2c2^c integers: the probability that the bitwise XOR is equal to xx in the end for xx in 0,1,…,2c−1{0, 1, \ldots, 2^c-1} modulo 998 244 353998\,244\,353.

输出 2c2^c 个整数:对于 x∈{0,1,…,2c−1}x \in \{0, 1, \ldots, 2^c-1\},最终按位异或(XOR)结果等于 xx 的概率,对 998 244 353998\,244\,353 取模。

输入输出样例

  • 输入#1

    4 1 3
    1 2 3 4

    输出#1

    0 0 0 748683265 0 499122177 0 748683265

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

首页