-
Notifications
You must be signed in to change notification settings - Fork 218
/
Copy pathCovid.cpp
43 lines (42 loc) · 932 Bytes
/
Covid.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include<bits/stdc++.h>
//covid cpp
using namespace std;
int main()
{
int t = 0;
cin>>t;
for (int i = 0; i < t; i++)
{
int size = 0;
cin>>size;
vector<int> v(size, 0);
for (int j = 0; j < size; j++)
cin>>v[j];
int a = -1, flag = 0;
for(int j = 0; j < size; j++)
{
if(v[j] == 1)
{
if(a == -1)
a = j;
else
{
if(j - a < 6)
{
flag = 1;
break;
}
else
{
a = j;
}
}
}
}
if(flag)
cout<<"NO"<<endl;
else
cout<<"YES"<<endl;
}
return 0;
}