-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathengxor.cpp
More file actions
executable file
·95 lines (87 loc) · 1.86 KB
/
engxor.cpp
File metadata and controls
executable file
·95 lines (87 loc) · 1.86 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long int
#define pb push_back
#define mk make_pair
#define flp(i, k, n) for(int i=k; i<n; i++)
#define F first
#define S second
int power(int a, int b) {
int x = 1, y = a;
while(b > 0) {
if(b%2 == 1) {
x=(x*y);
if(x>mod) x%=mod;
}
y = (y*y);
if(y>mod) y%=mod;
b /= 2;
}
return x;
}
int totient(int n) {
int result = n;
for(int i=2;i*i <= n;i++)
{
if (n % i == 0) result -= result / i;
while (n % i == 0) n /= i;
}
if (n > 1) result -= result / n;
return result;
}
int readInt () {
bool minus = false;
int result = 0;
char ch;
ch = getchar();
while (true) {
if (ch == '-') break;
if (ch >= '0' && ch <= '9') break;
ch = getchar();
}
if (ch == '-') minus = true; else result = ch-'0';
while (true) {
ch = getchar();
if (ch < '0' || ch > '9') break;
result = result*10 + (ch - '0');
}
if (minus)
return -result;
else
return result;
}
int32_t main(void)
{
int t;
scanf("%lli", &t);
while(t--){
int n, q;
scanf("%lli", &n);
scanf("%lli", &q);
int a[n];
flp(i, 0, n) scanf("%lli", &a[i]);
int count1=0, count2=0;
flp(i, 0, n)
{
if((__builtin_popcountll(a[i]))%2==0) count1++;
else count2++;
}
flp(i, 0, q)
{
int p;
scanf("%lli", &p);
if((__builtin_popcountll(p))%2==0)
{
printf("%lli ",count1);
printf("%lli \n", count2);
}
else
{
printf("%lli ", count2);
printf("%lli \n",count1);
}
}
}
return 0;
}