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;
bool solve(vector <int> a,int k,bool rev){
long long cnt[2] = {};
for (auto x:a)cnt[x&1]++;
if (k == 1){
return ((cnt[1]&1)^rev);
}
else{
vector <int> tmp;
for (auto x:a){
if ((x&1) == 0){
tmp.push_back(x/2);
}
}
return solve(tmp,k/2,(rev ^ (cnt[1]&1)));
}
}
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;
vector <int> a(n);
for (auto &x:a)cin>>x;
cout<<solve(a,k,0);
}
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... |