Codechef 23:
https://www.codechef.com/MARCH20B/problems/ENGXOR
def Bits(n):
count = 0
while (n):
n &= (n-1)
count+= 1
return count
for _ in range(int(input())):
n,q=map(int,input().split())
a=[int(i) for i in input().split()]
for _ in range(q):
p=int(input())
even=0
odd=0
for i in a:
if Bits(p^i)%2 ==0:
even+=1
else:
odd+=1
print(even,odd)
Comments
Post a Comment