# Feedback for JACK_ problem

Problem Link: JACK_ Problem - CodeChef

### Feedback

how is this program passing for the test case
1
5
1 1 1 1 0
as there are only 5 numbers and program is giving yes.

Its working fine for me .
Yeah for this test case it will be NO.
can u send the code for which u got accepted and then this test case shows wrong ans.

https://www.codechef.com/viewsolution/91975277
include
using namespace std;

int main() {
int t;
cin>>t;
while(t–)
{
int n;
cin>>n;
int a[n];
int s=0,p=0;
for(int i=0;i<n;i++)
{
cin>>a[i];
if(a[i]%2==0)
{
s++;
}
else
{
p++;
}
}
if((p==0)||(s==0)&&(p%2==0)||n<5)
{
cout<<“NO”<<endl;
}
else if(p>=1&&s>=1)
{
cout<<“YES”<<endl;
}
}
return 0;
}

Yeah u r right your code is logically not complete but it passes all the test cases .
They have not considered this test case .
This is the logic i have written which will pass all test case even yours .
I hope u will get it.

``````int n;
cin>>n;
int a[n];
int c=0,c1=0;
for(int i=0;i<n;i++)
{
cin>>a[i];
if(a[i]%2==0)
c++;
else
c1++;
}
if((c1>=1&&c>=4)||(c1>=3&&c>=2)||(c1>=5))
cout<<"YES";
else
cout<<"NO";
cout<<endl;
``````

thank you i have understood. but i am not getting why is this code incorrect
void solve()
{
int n;
cin>>n;

``````if(n<5) {
cout<<"NO\n";
return;
}

int ans = 0;
int odd = 0;

for(int  i = 0; i<n; i++)
{
int x = 0;
cin>>x;
if((x&1) == 1)
{
odd++;
}
}
int even = n - odd;

if((odd&1) == 0)
{
ans += (odd - 1);
}
else
ans = odd;

if(ans + even >= 5 && odd > 0)
{
cout<<"YES\n";
}
else
cout<<"NO\n";
``````

}