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 NMAX = 1e5 + 5;
int a[NMAX];
int solve(int N, int K) {
int sum = 0;
for(int i = 1; i <= N; ++i)
sum = (sum + a[i]) % 2;
if(K == 1 || sum)
return sum;
for(int i = 1; i <= N; ++i)
a[i] >>= 1;
return solve(N, K >> 1);
}
void test_case() {
int N, K;
cin >> N >> K;
for(int i = 1; i <= N; ++i)
cin >> a[i];
cout << solve(N, K);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int T;
cin >> T;
for(int tc = 0; tc < T; ++tc)
test_case();
}
# | 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... |