#include <bits/stdc++.h>
using namespace std;
const int K = 31;
const int N = 1e5 + 7;
int n, k;
int sz[N];
int game() {
cin >> n >> k;
for (int i = 0; i < n; ++i)
cin >> sz[i];
int res = 0;
while (true) {
int xr = 0;
for (int i = 0; i < n; ++i)
xr ^= sz[i];
if (xr & 1) {
res = 1;
break;
}
if (k == 1)
break;
k >>= 1;
for (int i = 0; i < n; ++i)
sz[i] >>= 1;
}
return res;
}
int main() {
#ifdef LOCAL
freopen("input.txt", "r", stdin);
#endif
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
string ans = "";
while (t--)
ans.push_back('0' + game());
cout << ans << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
364 KB |
Output is correct |
2 |
Correct |
14 ms |
1388 KB |
Output is correct |
3 |
Correct |
12 ms |
1388 KB |
Output is correct |
4 |
Correct |
13 ms |
1388 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
0 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
384 KB |
Output is correct |
2 |
Correct |
10 ms |
620 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
748 KB |
Output is correct |
2 |
Correct |
20 ms |
1388 KB |
Output is correct |
3 |
Correct |
20 ms |
1260 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
620 KB |
Output is correct |
2 |
Correct |
37 ms |
2284 KB |
Output is correct |
3 |
Correct |
31 ms |
2412 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
364 KB |
Output is correct |
2 |
Correct |
13 ms |
1388 KB |
Output is correct |
3 |
Correct |
16 ms |
1388 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
364 KB |
Output is correct |
2 |
Correct |
13 ms |
1388 KB |
Output is correct |
3 |
Correct |
14 ms |
1388 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
492 KB |
Output is correct |
2 |
Correct |
14 ms |
1388 KB |
Output is correct |