# COVIDTEST GETING ( WA) EVEN AFTER RIGHT ANSWER I AM NEW HERE HELP ME OUT plzzz

int test,ncircle;

``````Scanner sc=new Scanner(System.in);

test=sc.nextInt();

String[] ans=new String[test];

int c=0;

while(test!=0)

{

test--;

ncircle=sc.nextInt();

int[] series=new int[ncircle];

for(int i=0;i<ncircle;i++)

{

series[i]=sc.nextInt();

}

for(int i=0;i<series.length;i++)

{

if(series[i]==1)

{

if(i+5<series.length)

{

for(int j=i+1;j<=i+5;j++)

{

if(series[j]==1)

{

ans[c]="NO";

break;

}

else

{

ans[c]="YES";

}

}

}

else

{

for(int j=i+1;j<series.length;j++)

{

if(series[j]==1)

{

ans[c]="NO";

break;

}

else

ans[c]="YES";

}

}

}

}

c++;

}

for(int ii=0;ii<ans.length;ii++)

{

System.out.println(ans[ii]);

}``````

bro just try to put
1
6
0 0 0 0 0 1
@dilip_singh

import java.util.*;

public class Covid19 {

public static void main(String[] args) {

``````Scanner sc=new Scanner(System.in);

int test,circle=0,i,p1=-1,p2=-1;

int t=test=sc.nextInt();
``````

String ans=null;

``````while(test!=0)

{

test--;

circle=sc.nextInt();

int[] entry=new int[circle];

for(i=0;i<circle;i++)

{

entry[i]=sc.nextInt();

if(entry[i]==1)

{

if(p1==-1)

{

p1=i;

}

else

{

p2=i;

}

if(p1!=-1 && p2!=-1)

{

if(p2-p1>=6)

{

ans="YES";

p1=p2;

p2=-1;

}

else

{

ans="NO";

}

}

else{

if(p1!=-1)

{

ans="YES";

}

}

}

else

{

ans="YES";

}

}

System.out.println(ans);

}
``````

}

}

hey bro i updated my program now all possible i tried but still getting same result when i submit…please help me … i amtrying this from 9 oclock and still trying…

1
11
1 0 0 0 0 1 0 0 0 0 0
check this
@dilip_singh

import java.util.*;

public class Covid19 {

public static void main(String[] args) {

``````Scanner sc=new Scanner(System.in);

int test,circle=0,i,p1=-1,p2=-1;

int t=test=sc.nextInt();
``````

String ans=null;

``````while(test!=0)

{

test--;

circle=sc.nextInt();

int[] entry=new int[circle];

for(i=0;i<circle;i++)

{

entry[i]=sc.nextInt();

if(entry[i]==1)

{

if(p1==-1)

{

p1=i;

}

else

{

p2=i;

}

if(p1!=-1 && p2!=-1)

{

if(p2-p1>=6)

{

ans="YES";

p1=p2;

p2=-1;

}

else

{

ans="NO";

}

}

else{

if(p1!=-1)

{

ans="YES";

}

}

}

}

System.out.println(ans);

}
``````

}

}