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;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define int long long int
//#define endl '\n'
#define N 2100
#define M 32
#define big 2147483647
#define bigg 9223372036854775807
#define pb push_back
#define p push
#define ins insert
#define f first
#define s second
signed main(){
lalala;
int test;cin>>test;
while(test--){
int n,k;cin>>n>>k;
int top=0;
for(int i=0;i<n;i++){
int x;cin>>x;
top+=x;
}
//cout<<top<<endl;
if(k==1){
if(top%2==0)cout<<0;
else cout<<1;
}
else{
int ok=0;
for(int i=0;i<M;i++){
int x=((ll)1<<i);
if(x>top||x>k)break;
if(top%x==0){
if((top/x)%2){
ok=1;break;
}
}
}
cout<<ok;
}
}
cout<<endl;
}
# | 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... |