Advertisement
Guest User

Untitled

a guest
Apr 21st, 2021
16,635
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 1 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int pre[2005];
  4. int main()
  5. {
  6.     int t;
  7.     scanf("%d",&t);
  8.     while (t--)
  9.     {
  10.         int n;
  11.         scanf("%d",&n);
  12.         for (int i=1;i<=n;i++)
  13.         {
  14.             int a;
  15.             scanf("%d",&a);
  16.             pre[i]=(pre[i-1]^a);
  17.         }
  18.         bool yes=!pre[n];
  19.         for (int i=1;i<=n;i++)
  20.         {
  21.             for (int j=i+1;j<n;j++)
  22.             yes|=(pre[i]==(pre[j]^pre[i]) && pre[i]==(pre[n]^pre[j]));
  23.         }
  24.         puts(yes? "YES":"NO");
  25.     }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement