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 all(x) x.begin(),x.end()
#define int long long
#define ACorz ios_base::sync_with_stdio(false);cin.tie(0);
void solve(){
int n,k;cin>>n>>k;
vector<int> v(n);
int total=0,total2=0;
for(int i=0;i<n;i++){
cin>>v[i];
total+=v[i];
total2+=v[i]/2;
}
if(k==1){
cout<<(total&1);
return;
}
cout<<((total&1)|(total2&1));
}
int32_t main(){
ACorz;
int t=1;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... |