CF1616H.Keep XOR Low

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

You are given an array a1,a2,,ana_1, a_2, \ldots, a_n and an integer xx .

Find the number of non-empty subsets of indices of this array 1b1<b2<<bkn1 \leq b_1 < b_2 < \ldots < b_k \leq n , such that for all pairs (i,j)(i, j) where 1i<jk1 \leq i < j \leq k , the inequality abiabjxa_{b_i} \oplus a_{b_j} \leq x is held. Here, \oplus denotes the bitwise XOR operation. As the answer may be very large, output it modulo 998244353998\,244\,353 .

输入格式

The first line of the input contains two integers nn and xx ( 1n1500001 \leq n \leq 150\,000 , 0x<2300 \leq x < 2^{30} ). Here, nn is the size of the array.

The next line contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n ( 0ai<2300 \leq a_i < 2^{30} ): the array itself.

输出格式

Print one integer: the number of non-empty subsets such that the bitwise XOR of every pair of elements is at most xx , modulo 998244353998\,244\,353 .

输入输出样例

  • 输入#1

    4 2
    0 1 2 3

    输出#1

    8
  • 输入#2

    3 6
    4 2 2

    输出#2

    7
  • 输入#3

    4 0
    1 1 2 2

    输出#3

    6
首页