#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll t, n , k;
vector<int>v;
cin >> t;
while(t--)
{
cin >> n >> k ;
v.clear();
v.resize(n);
ll sum=0;
for(int i = 0 ; i < n ; i++)
{
cin >> v[i];
sum+=v[i];
}
if(sum&1)
{
cout <<1;
continue;
}
while(k!=1&&sum%2==0)
{
for(int i = 0 ; i < n ; i++)
{
sum-=v[i];
v[i]/=2;
sum+=v[i];
}
k/=2;
}
if(k>1)
{
cout<< 1;
continue;
}
if(sum&1)
{
cout <<1;
continue;
}
cout << 0;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
1388 KB |
Output is correct |
2 |
Correct |
14 ms |
1388 KB |
Output is correct |
3 |
Correct |
13 ms |
1388 KB |
Output is correct |
4 |
Correct |
13 ms |
1388 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
0 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
620 KB |
Output is correct |
2 |
Correct |
9 ms |
620 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
1132 KB |
Output is correct |
2 |
Correct |
26 ms |
1132 KB |
Output is correct |
3 |
Correct |
26 ms |
1132 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
43 ms |
2028 KB |
Output is correct |
2 |
Correct |
47 ms |
2028 KB |
Output is correct |
3 |
Correct |
39 ms |
2156 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
1388 KB |
Output is correct |
2 |
Correct |
13 ms |
1388 KB |
Output is correct |
3 |
Correct |
16 ms |
1388 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
1388 KB |
Output is correct |
2 |
Correct |
16 ms |
1388 KB |
Output is correct |
3 |
Correct |
14 ms |
1388 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
1388 KB |
Output is correct |
2 |
Correct |
14 ms |
1388 KB |
Output is correct |