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 debug(args) kout("[ " + string(#args) + " ]", args)
void kout() { cerr << endl; }
template <class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ',kout(b...); }
template <class T> void pary(T L, T R) { while (L != R) cerr << *L << " \n"[++L==R]; }
const int MAXN = 100000;
int T, N, K;
int a[MAXN];
string ans;
inline int lb(int a) {
return a &- a;
}
bool solve(int k) {
int cnt = 0;
for (int i = 0; i < N; i++) {
cnt += (a[i] & 1);
}
if (cnt % 2) return true;
for (int i = 0; i < N; i++) {
a[i] /= 2;
}
return false;
}
signed main() {
ios_base::sync_with_stdio(0), cin.tie(0);
cin >> T;
while (T--) {
cin >> N >> K;
for (int i = 0; i < N; i++) {
cin >> a[i];
}
bool flag = false;
for (int i = 1; i <= K && !flag; i *= 2) {
flag |= solve(i);
}
ans += (flag ? '1' : '0');
}
cout << ans << '\n';
}
# | 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... |