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>
#define ll long long
#define in insert
#define pb push_back
#define vl vector<ll>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define speed ios_base::sync_with_stdio(false);cin.tie(0);
#define F first
#define S second
using namespace std;
int main(){
speed;
ll t=1,n,k,i,sum=0;
cin>>t;
while(t--){sum=0;
cin>>n>>k;
vl v(n);
for(i=0;i<n;i++){
cin>>v[i];sum+=v[i];
}
if(sum%2==1){cout<<1;continue;}
if(k==1){
cout<<0;
}
else if(n==1){
if(k>=sum){cout<<1;continue;}
ll x=2;
//bool as=0;
while(x<=k){
if(sum%x==0&&(sum/x)%2==1){cout<<1;/*as=1;*/break;}
x*=2;
}
if(x>k){
cout<<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... |