-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2109a.cpp
More file actions
39 lines (34 loc) · 833 Bytes
/
2109a.cpp
File metadata and controls
39 lines (34 loc) · 833 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
#include <bits/stdc++.h>
using namespace std;
#define NO cout<<"NO\n"
#define YES cout<<"YES\n"
#define F first
#define S second
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef set<int> si;
int main() {
int _; cin >> _;
while(_--) {
int a; cin >> a;
vi A(a);
ull z_count = 0;
for(int i = 0; i < a; i++) {cin >> A[i]; if(A[i] == 0) z_count++;}
if(z_count == 0) YES;
else if (z_count == a) YES;
else {
bool u = false;
for(int i = 1; i < a; i++) {
if(A[i-1] == 0 && A[i] == 0) {
YES;
u=true;
break;
}
}
if(!u) NO;
}
}
return 0;
}