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;
void main_program();
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0);
int T; cin >> T;
while (T--) main_program();
cout << "\n";
}
int n, k, p;
vector<int> v;
int solve(vector<int> &a){
if (p > k) return 0;
bool all0 = true;
int parity = 0;
for (auto i: a){
all0 &= (!i);
parity ^= i;
}
if (all0) return 0;
if (parity & 1) return 1;
else{
for (auto &i: a) i >>= 1;
p <<= 1;
return solve(a);
}
}
void main_program(){
cin >> n >> k; p = 1;
v.resize(n); for (auto &i: v) cin >> i;
cout << solve(v);
}
# | 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... |