-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCC-ENGXOR.cpp
More file actions
43 lines (37 loc) · 755 Bytes
/
CC-ENGXOR.cpp
File metadata and controls
43 lines (37 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll count(ll x)
{
x = (x & 0x55555555) + ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
x = (x & 0x0F0F0F0F) + ((x >> 4) & 0x0F0F0F0F);
x = (x & 0x00FF00FF) + ((x >> 8) & 0x00FF00FF);
x = (x & 0x0000FFFF) + ((x >> 16)& 0x0000FFFF);
return x;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin >> t;
while(t--){
ll n,q,odd=0,even=0;
cin >> n >> q;
for(ll i=0;i<n;i++){
ll a;
cin >> a;
if(count(a)%2==0){
even++;
}
}
for(ll i=0;i<q;i++){
ll p;
cin >> p;
if(count(p)%2==0){
cout << even << " " << n-even << "\n";
}else cout << n-even << " " << even << "\n";
}
}
return 0;
}