rt,WA on #2。
#include<bits/stdc++.h>
#define int long long
#define psbk push_back
#define fst first
#define scd second
#define umap unordered_map
#define pqueue priority_queue
#define vc vector
#define endl '\n'
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
const int inf = 0x3f3f3f3f;
int tt;
int n, q, a[200005], pre[200005] = {};
void solve()
{
cin >> n >> q;
map<int, vc<int> > mp;
for(int i=1;i<=n;i++)
{
cin >> a[i];
pre[i] = (pre[i - 1] ^ a[i]);
mp[pre[i]].psbk(i);
}
while(q--)
{
int l, r;
cin >> l >> r;
if(pre[r] ^ pre[l - 1])
{
auto pos1 = lower_bound(all(mp[pre[r]]), l);
if(pos1 == mp[pre[r]].end())
{
cout << "NO" << endl;
continue;
}
auto pos2 = upper_bound(all(mp[pre[r] ^ pre[l - 1] ^ pre[*pos1]]), *pos1);
if(pos2 == mp[pre[pre[r] ^ pre[l - 1] ^ pre[*pos1]]].end() || *pos2 >= r)
{
cout << "NO" << endl;
}
else
{
cout << "YES" << endl;
}
}
else
{
cout << "YES" << endl;
}
}
cout << endl;
}
signed main()
{
// freopen("1.in","r",stdin);
// freopen("1.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> tt;
while(tt--)
{
solve();
}
return 0;
}