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 pb push_back
#define ll long long
#define s second
#define f first
#define left (node<<1),l,((l+r)>>1)
#define right ((node<<1)|1),((l+r)>>1) + 1,r
// #define int ll
using namespace std;
const int N = 5e5 + 5;
int a[N];
ll sum;
signed main() {
ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
int T;
cin>>T;
while (T--){
int n; ll k;
cin>>n>>k;
for (int i = 1; i <= n; i++){
cin>>a[i];
sum += a[i];
}
if (sum&1){
cout<<'1';
continue;
}
if (k == 1){
cout<<'0';
continue;
}
ll cnt=0;
for (int i = 1; i <= n; i++)
cnt += a[i]/2;
if (cnt & 1){
cout<<'1';
}else{
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... |