이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define int long long int
//#define endl '\n'
#define N 2100
#define M 30
#define big 2147483647
#define bigg 9223372036854775807
#define pb push_back
#define p push
#define ins insert
#define f first
#define s second
signed main(){
lalala;
int test;cin>>test;
while(test--){
int n,k;cin>>n>>k;
int top=0;
for(int i=0;i<n;i++){
int x;cin>>x;
top+=x;
}
//cout<<top<<endl;
if(k==1){
if(top%2==0)cout<<0;
else cout<<1;
}
else{
int ok=0;
for(int i=0;i<M;i++){
int x=((ll)1<<i);
if(x>top)break;
if(top%x==0){
if((top/x)%2){
ok=1;break;
}
}
}
cout<<ok;
}
}
cout<<endl;
}
# | 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... |