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 a[100005];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int T = 1;
cin >> T;
for (; T; -- T ) {
int N, K;
cin >> N >> K;
for (int i = 1; i <= N; ++ i ) {
cin >> a[i];
}
bool ans = 0;
long long S = 0;
for (int i = 1; i <= N; ++ i )
S += 1LL * a[i];
if (S % 2 == 1)
ans = 1;
while (K > 1 && !ans) {
for (int i = 1; i <= N; ++ i )
a[i] /= 2;
long long sum = 0;
for (int i = 1; i <= N; ++ i )
sum += 1LL * a[i];
if (sum % 2 == 1) {
ans = 1;
break;
}
K /= 2;
}
cout << ans;
}
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... |