View Code of Problem 3929

#include<iostream>
#include<map>
using namespace std;
const int N = 10010;
int a[N];
int n, t;
int ans;
map<int,int> mp;
int main()
{
    cin >> t;
    while(t --)
    {
        cin >> n;
        for(int i = 0;i < n;i ++)
        {
            cin >> a[i];
            mp[a[i]] ++;
        }
        for(auto x : mp)
        {
            if(x.second % 2 != 0) ans ^= x.first;
        }
        cout << ans << endl;
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 3929