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>
using namespace std;
int t,k,i,n,ok,s1;
int long long s,v[100011];
int main()
{
cin>>t;
while (t!=0)
{ok=0;
t--;
cin>>n>>k;
s=0;
for (i=1; i<=n; i++)
{
cin>>v[i];
s=s+v[i];
}
if (s%2==1) cout<<1;
else
{
if (k==1) cout<<0;
if (k%2==1) k--;
if (n==1)
{
if ((v[1]/2)%2==1) cout<<1;
}
if (k==2)
{
for (i=1; i<=n; i++)
{
s1=s1+v[i]/2;
if (v[i]%2==1)
{
ok=1;
}
}
if (ok==0) cout<<1;
else
{
if (s1%2==1) cout<<1;
else cout<<0;
}
}
}
}
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... |