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>
#include <algorithm>
#include <cstring>
#define int long long
#define MAX 1000002
using namespace std;
int t,n,k,a[MAX],nrp,tmp,s,c[MAX],lst,maxi;
bool gasit;
pair<int, int> st[MAX];
bool check(){
s = 0;
for(int i = 1; i <= n; i++){
s += a[i];
}
return (s%2);
}
void solve(){
cin >> n >> k;
for(int i = 1; i <= n; i++){
cin >> a[i];
}
if(check()){
cout << "1";
return ;
}
while(k > 1){
for(int i = 1; i <= n; i++){
a[i] /= 2;
}
k /= 2;
if(check()){
cout << "1";
return ;
}
}
cout << "0";
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
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... |