My issue
why only if the sum of elements of array B is even then only we are able to get a valid array A?
My code
#include <iostream>
using namespace std;
int main() {
int T;cin>>T;
for(int i=0;i<T;i++){
int N;cin>>N;
int A[N];int B[N];
int sum=0;
for(int i=0;i<N;i++){
cin>>B[i];
sum+=B[i];
}
if(sum%2==0)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return 0;
}
Problem Link: ADJSUMPAR Problem - CodeChef