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;
int t;
void solve ()
{
long long int n, k, v[100005];
cin >> n >> k;
long long s=0;
for (int i=1;i<=n;i++)
{
cin >> v[i];
s+=v[i];
}
while (k!=1 && s%2!=1)
{
s=0;
for (int i=1;i<=n;i++)
{
v[i]/=2;
s+=v[i];
}
k/=2;
}
if (k==1 && s%2==1)
{
cout << 1;
return;
}
if (k>1 && s%2==1)
{
cout << 1;
return;
}
if (k==1 && s%2==0)
{
cout << 0;
return;
}
return;
}
int main()
{
ios :: sync_with_stdio (0);
cin.tie (nullptr);
cin >> t;
while (t--)
{
solve ();
}
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... |