CF1616H.Keep XOR Low
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given an array a1,a2,…,an and an integer x .
Find the number of non-empty subsets of indices of this array 1≤b1<b2<…<bk≤n , such that for all pairs (i,j) where 1≤i<j≤k , the inequality abi⊕abj≤x is held. Here, ⊕ denotes the bitwise XOR operation. As the answer may be very large, output it modulo 998244353 .
输入格式
The first line of the input contains two integers n and x ( 1≤n≤150000 , 0≤x<230 ). Here, n is the size of the array.
The next line contains n integers a1,a2,…,an ( 0≤ai<230 ): 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 x , modulo 998244353 .
输入输出样例
输入#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