Today is my friend's birthday. I want to give a gift to my friend. So I am desperately searching for some gift here and there.
Fortunately, I found an array a of size n lying around. The array contains positive integers. My friend likes even numbers very much. So for the gift, I will choose a consecutive non-empty segment of the array. The segment should contain exactly k even integers. Though it can have any number of odd integers.
I will then pick that segment and gift it to my friend.
But there is a problem. It might not be always possible for me to choose such a segment. Please tell whether it is possible for me to select some gift or not?
Input
First line of the input contains a single integer T denoting number of test cases.
For each test case, first line contains two space separated integers n, k.
Next line contains n space separated integers denoting content of array a.
It is also guaranteed that all the numbers in the array a are distinct.
Output
For each test case, print a single line containing "YES" or "NO" (without quotes) corresponding to the situation.
Constraints
1 ≤ T ≤ 10
1 ≤ n ≤ 50
0 ≤ k ≤ n
1 ≤ a i ≤ 100
Example
Input:
4
2 1
1 2
3 2
2 6 5
3 3
2 4 5
4 2
1 2 4 5
Output:
YES
YES
NO
YES
Explanation
For first test case, we can select a[2, 2] = {2}.
For second test case, we can select a[1, 2] = {2, 6}.
For third test case, we can not select any consecutive segment having exactly 3 even numbers.
etc.
here is the code:
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
int b=0,i,T,n,k,j;
scanf("%d",&T);
while(!(T>=1&&T<=10))
cin>>T;
int a[100];
for(i=0;i<T;i++)
{
cin>>n;
while(!(n>=1&&n<=50))
cin>>n;
cin>>k;
while(!(k>=1&&k<=n))
cin>>k;
for(j=0;j<n;j++)
{
cin>>a[i];
}
for(j=0;j<n;j++)
{
if(a[j]%2==0)
b++;
}
if(b>k||b==k)
cout<<"YES";
else
cout<<"NO";
cout<<endl;
b=0;
}
}
for the sample input this code gives "NO" for the fourth case but correct for other three cases ...... but I cant get any error in my code ... plzz help