This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |