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;
int a[100100];
int b[100100];
int main(){
ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
int t;
cin>>t;
while (t--){
int n,k;
cin>>n>>k;
for (int i = 1;i <= n;i++)cin>>a[i];
while (1){
long long cnt[2] = {};
for (int i = 1;i <= n;i ++)cnt[a[i] & 1]+=a[i];
if (k == 1){
cout<<(cnt[1]&1);
break;
}
else{
if (cnt[1] & 1){
cout<<1;
break;
}
else{
k /= 2;
for (int i =1;i <=n;i++)a[i] /= 2;
}
}
}
}
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... |