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;
const int N = 1e5 + 3;
int test;
int n, k;
int a[N];
long long sum = 0;
int main()
{
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> test;
while (test--)
{
cin >> n >> k;
sum = 0;
for (int i = 1; i <= n; i++)
cin >> a[i], sum += a[i];
if (sum % 2)
{
cout << 1;
continue;
}
if (k == 1)
{
cout << 0;
continue;
}
long long cur = 0;
int res = 0;
for (int j = 1; (1 << j) <= k; j++)
{
for (int i = 1; i <= n; i++)
{
cur = cur + a[i] / (1 << j);
}
if (cur % 2)
{
res = 1;
break;
}
}
cout << res;
}
}
# | 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... |