CF665E.Beautiful Subarrays

提高+/省选-

通过率:0%

时间限制:3.00s

内存限制:512MB

AC君温馨提醒

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

题目描述

One day, ZS the Coder wrote down an array of integers a with elements _a_1,  _a_2,  ...,  a__n.

A subarray of the array a is a sequence a__l,  a__l  +  1,  ...,  a__r for some integers (l,  r) such that 1  ≤  l  ≤  r  ≤  n. ZS the Coder thinks that a subarray of a is beautiful if the bitwise xor of all the elements in the subarray is at least k.

Help ZS the Coder find the number of beautiful subarrays of a!

有一天,ZS the Coder 写下了一个整数数组 aa,其元素为 a1,a2,…,ana_1, a_2, \dots, a_n。

数组 aa 的一个子数组是指形如 al,al+1,…,ara_l, a_{l+1}, \dots, a_r 的序列,其中整数对 (l,r)(l, r) 满足 1≤l≤r≤n1 \le l \le r \le n。ZS the Coder 认为,若一个子数组中所有元素的按位异或(bitwise xor)值不小于 kk,则该子数组是“美丽的”。

请帮助 ZS the Coder 求出数组 aa 中“美丽”子数组的个数!

输入格式

The first line contains two integers n and k (1 ≤ n ≤ 106, 1 ≤ k ≤ 109) — the number of elements in the array a and the value of the parameter k.

The second line contains n integers a__i (0 ≤ a__i ≤ 109) — the elements of the array a.

第一行包含两个整数 nn 和 kk(1 ≤ n ≤ 1061 \leq n \leq 10^6,1 ≤ k ≤ 1091 \leq k \leq 10^9)—— 分别表示数组 aa 的元素个数以及参数 kk 的值。

第二行包含 nn 个整数 aia_i(0 ≤ ai ≤ 1090 \leq a_i \leq 10^9)—— 表示数组 aa 的元素。

输出格式

Print the only integer c — the number of beautiful subarrays of the array a.

输出唯一的整数 cc —— 数组 aa 中优美子数组的个数。

输入输出样例

  • 输入#1

    3 1
    1 2 3

    输出#1

    5
  • 输入#2

    3 2
    1 2 3

    输出#2

    3
  • 输入#3

    3 3
    1 2 3

    输出#3

    2

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

首页