Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2022
600
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define endl '\n'
  4.  
  5. int main(){
  6.     int t;
  7.     cin>>t;
  8.     while(t--){
  9.         int n;
  10.         cin>>n;
  11.         unordered_map<int,int>mp;
  12.         for(int i=0; i<n; i++){
  13.             int val;
  14.             cin>>val;
  15.             mp[val] ^= 1;
  16.         }
  17.         int ans = 0;
  18.         for(auto entry: mp){
  19.             ans += entry.second;
  20.         }
  21.         ans += (4*((n+ans)/4+1)-(n+ans))%4;
  22.         cout<<ans<<endl;
  23.     }
  24. }
Advertisement
RAW Paste Data Copied
Advertisement