# [ CQOI 2018 ] 异或序列

$\\$

## Description

• $n,m,k,A_i\le 10^5$

$\\$

## Solution

$a[i]\oplus a[i+1]\oplus...\oplus a[j]=sum[i-1]\oplus sum[j]$

$sum[i]\oplus sum[j]=k$

$\\$

$\\$

## Code

#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define N 100010
#define R register
#define gc getchar
using namespace std;
typedef long long ll;

inline ll rd(){
ll x=0; bool f=0; char c=gc();
while(!isdigit(c)){if(c=='-')f=1;c=gc();}
while(isdigit(c)){x=(x<<1)+(x<<3)+(c^48);c=gc();}
return f?-x:x;
}

ll n,m,k,ans,bl[N],cnt[1<<18],s[N],res[N];

struct Q{ll l,r,id;}q[N];

inline bool cmp1(Q x,Q y){
return bl[x.l]==bl[y.l]?x.r<y.r:bl[x.l]<bl[y.l];
}

inline bool cmp2(Q x,Q y){return x.id<y.id;}

inline void del(int p){
--cnt[s[p]];
ans-=cnt[k^s[p]];
}

ans+=cnt[k^s[p]];
++cnt[s[p]];
}

int main(){
n=rd(); m=rd(); k=rd();
ll t=sqrt(n);
for(R ll i=1;i<=n;++i){
s[i]=s[i-1]^rd();
bl[i]=i/t+1;
}
for(R ll i=1;i<=m;++i){
q[i].l=rd()-1; q[i].r=rd(); q[i].id=i;
}
sort(q+1,q+1+m,cmp1);
ll nowl=0,nowr=0;
cnt[0]=1;
for(R ll i=1;i<=m;++i){