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 ll;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll t, n , k;
vector<int>v;
cin >> t;
while(t--)
{
cin >> n >> k ;
v.clear();
v.resize(n);
ll sum=0;
for(int i = 0 ; i < n ; i++)
{
cin >> v[i];
sum+=v[i];
}
if(sum&1)
{
cout <<1;
continue;
}
while(k!=1&&sum%2==0)
{
for(int i = 0 ; i < n ; i++)
{
sum-=v[i];
v[i]/=2;
sum+=v[i];
}
k/=2;
}
if(k>1)
{
cout<< 1;
continue;
}
if(sum&1)
{
cout <<1;
continue;
}
cout << 0;
}
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... |