CF1616H.Keep XOR Low
NOI/NOI+/CTSC
通过率:0%
时间限制:1.00s
内存限制:256MB
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.
给你一个数组 a1,a2,…,an 和一个整数 x。
请找出该数组中满足如下条件的非空下标子集 1≤b1<b2<…<bk≤n 的个数:对所有满足 1≤i<j≤k 的数对 (i,j),均有不等式 abi⊕abj≤x 成立。其中,⊕ 表示按位异或运算。由于答案可能非常大,请将结果对 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.
输入的第一行包含两个整数 n 和 x(1≤n≤150000,0≤x<230)。其中,n 表示数组的大小。
第二行包含 n 个整数 a1,a2,…,an(0≤ai<230):即该数组本身。
输出格式
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.
输出一个整数:满足“任意两个元素的按位异或值不超过 x”的非空子集的个数,对 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
输入解题思路,AI测评打分。不知道怎么写?