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;
#define ll long long
const int N = 1e5+1;
ll a[N], n, k;
bool check() {
int s=0;
for (int i=1; i<=n; ++i) s+=a[i]%2;
s%=2;
return s;
}
void solve() {
cin>>n>>k;
for (int i=1; i<=n; ++i) cin>>a[i];
bool ans=check();
while (k > 1) {
for (int i=1; i<=n; ++i) a[i]/=2;
k/=2;
if (check()) {
ans=true;
break;
}
}
if (ans) cout<<"1";
else cout<<"0";
}
int main() {
int t; cin>>t;
while (t--) solve();
}
# | 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... |