이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define s second
#define f first
#define left (node<<1),l,((l+r)>>1)
#define right ((node<<1)|1),((l+r)>>1) + 1,r
#define int ll
using namespace std;
const int N = 1e5 + 5;
int a[N];
signed main() {
ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
int T;
cin>>T;
while (T--){
int n; ll k;
cin>>n>>k;
ll sum=0;
for (int i = 1; i <= n; i++){
cin>>a[i];
sum += a[i];
}
if (sum&1){
cout<<'1';
continue;
}
int p = 0;
for (ll i = 2; i <= k; i *= 2){
ll cnt=0;
for (int j = 1; j<= n; j++){
cnt += a[j]/i;
}
if (cnt & 1){
p = 1;
break;
}
}
if (p) cout<<'1';
else cout<<'0';
}
}
/*
2
1 2
8
1 4
12
*/
# | 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... |