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 <iostream>
using namespace std;
const int maxn = 1000005;
int n, k;
int a[maxn];
void solve()
{
cin >> n >> k;
long long sum = 0;
for (int i = 1; i <= n; ++i)
{
cin >> a[i];
sum += a[i];
}
while (sum % 2 == 0 && k != 1)
{
k /= 2;
sum = 0;
for (int i = 1; i <= n; ++i)
{
a[i] /= 2;
sum += a[i];
}
}
if (sum % 2 == 1)
{
cout << 1;
}
else
{
cout << 0;
}
}
void fastIO()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int main()
{
fastIO();
int q;
cin >> q;
while (q--)
{
solve();
}
cout << endl;
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... |