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;
typedef long long int ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
ll t, n, k, total;
vector<ll> v;
cin >> t;
while (t--) {
cin >> n >> k;
total = 0;
v.assign(n, 0);
for (int i = 0; i < n; i++) {
cin >> v[i];
total += v[i];
}
if (total % 2 == 1) {
cout << 1;
continue;
}
while (k > 1 && total % 2 == 0) {
for (int i = 0; i < n; i++) {
total -= v[i];
v[i] /= 2;
total += v[i];
}
k /= 2;
}
if (k > 1)
cout << 1;
else if (total % 2 == 1)
cout << 1;
else
cout << 0;
}
cout << '\n';
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... |