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;
using ll = long long;
int tc, n, k, a[100100];
int main(){
cin.tie(0)->sync_with_stdio(0);
cin >> tc;
while(tc--) {
cin >> n >> k;
for(int i=1;i<=n;i++) cin >> a[i];
ll s = 0;
while(1) {
s = 0;
for(int i=1;i<=n;i++) s += a[i];
if(k == 1 || s % 2) break;
for(int i=1;i<=n;i++) a[i] = a[i]/2;
k /= 2;
}
cout << s%2;
}
}
# | 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... |