-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCC-COVIDLQ.cpp
More file actions
47 lines (41 loc) · 778 Bytes
/
CC-COVIDLQ.cpp
File metadata and controls
47 lines (41 loc) · 778 Bytes
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
44
45
46
47
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define mod 1000000007
void shammi() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
int main() {
shammi();
ll t; cin >> t;
while (t--) {
ll n; cin >> n;
ll A[n];
for (ll i = 0; i < n; i++) cin >> A[i];
ll count = 0, counter = 0;
bool first = false;
bool isPossible = true;
for (ll i = 0; i < n; i++) {
if (A[i] == 0 && first) {
count++;
}
if (A[i] == 1) {
if (first) {
if (count < 5) {
isPossible = false;
break;
}
}
first = true;
count = 0;
}
}
if (isPossible) cout << "YES\n";
else cout << "NO\n";
}
return 0;
}