#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
ll t, n, k, total;
vector<ll> v;
cin >> t;
while (t--) {
cin >> n >> k;
total = 0;
v.assign(n, 0);
for (int i = 0; i < n; i++) {
cin >> v[i];
total += v[i];
}
if (total % 2 == 1) {
cout << 1;
continue;
}
while (k > 1 && total % 2 == 0) {
for (int i = 0; i < n; i++) {
total -= v[i];
v[i] /= 2;
total += v[i];
}
k /= 2;
}
if (k > 1)
cout << 1;
else if (total % 2 == 1)
cout << 1;
else
cout << 0;
}
cout << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
460 KB |
Output is correct |
2 |
Correct |
12 ms |
1356 KB |
Output is correct |
3 |
Correct |
13 ms |
1360 KB |
Output is correct |
4 |
Correct |
12 ms |
1356 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
204 KB |
Output is correct |
2 |
Correct |
9 ms |
316 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
332 KB |
Output is correct |
2 |
Correct |
24 ms |
324 KB |
Output is correct |
3 |
Correct |
24 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
42 ms |
352 KB |
Output is correct |
2 |
Correct |
36 ms |
360 KB |
Output is correct |
3 |
Correct |
37 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
476 KB |
Output is correct |
2 |
Correct |
13 ms |
1372 KB |
Output is correct |
3 |
Correct |
16 ms |
1360 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
460 KB |
Output is correct |
2 |
Correct |
16 ms |
1368 KB |
Output is correct |
3 |
Correct |
14 ms |
1356 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
460 KB |
Output is correct |
2 |
Correct |
14 ms |
1364 KB |
Output is correct |