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";
}
}