WA in COVID

Some one please help me with the COVID problem. Below is my code. It works perfectly fine for the test cases but still I get wrong answer.
#include <bits/stdc++.h>
using namespace std;

int main()
{
int t;
cin>>t;

for(int tests=1;tests<=t;tests++)
{
    bool res=1;
	int k;
	vector<int> v;
	cin>>k;
	int arr[k];
	for(int i=0;i<k;i++)
	{
		cin>>arr[i];
	}
	for(int i=0;i<k;i++)
	{
	    if(arr[i])
			v.push_back(i);
	}

	for(int i=0;i<v.size()-1;i++)
	{
	//	cout<<"i:"<<i<<"\ti+1:"<<i+1<<endl;
		if((v[i+1]-v[i])<6)
		{
			res=0;
			break;
		}
	}
	
	if(res)
		cout<<"YES";
	else
		cout<<"NO";
}

}

you didn’t used endl or “\n” in your cout statement so in this case your output and expected output will vary :wink:

use “\n” :laughing:

I think it is more than"\n".My solution also got WA
*#include
using namespace std;
int main()
{
int t,n,count;
cin>>t;

	while(t--)
	{
			cin>>n;
			int *a=new int[n];
			int *one=new int[n];
			int c=0,check=1,te;
			for (int i=0;i<n;i++)
			{
				
				cin>>a[i];
				
				if(a[i]==1)
				{
					one[c]=i;
					c++;
				}
			}
			if(c==1)
			{
				check=1;
			}
			else if(c==0)
			{
				check=0;
			}
			else
			{
			
				for(int j=0;j<c-1;j++)
				{
					if((one[j+1]-one[j])<6)
					{
						check=0;
						break;
					}

				}	
			}
				
			if(check==0)
			{
				cout<<"N0"<<endl;
			}
			else if(check==1)
			{
				cout<<"YES"<<endl;
			}
			delete [] one;
			delete [] a;
		
	}

}
*

Thanx. It helped