-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2091a.cpp
More file actions
28 lines (26 loc) · 904 Bytes
/
2091a.cpp
File metadata and controls
28 lines (26 loc) · 904 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
#include <bits/stdc++.h>
using namespace std;
int main() {
int _; cin >> _;
while (_--) {
int a; cin >> a; vector<int> A(a);
for(int i = 0; i < a; i++) cin >> A[i];
int zero_count = 0, two_count = 0, three_count = 0, one_count = 0, five_count = 0;
int counter = 0;
for(auto k : A) {
if(k == 0) zero_count++;
else if(k==2) two_count++;
else if(k==3) three_count++;
else if(k==1) one_count++;
else if(k==5) five_count++;
counter++;
if(zero_count >= 3 && two_count >= 2 && three_count >= 1 && one_count >= 1 && five_count >= 1) break;
}
if(zero_count >= 3 && two_count >= 2 && three_count >= 1 && one_count >= 1 && five_count >= 1) {
cout << a-(a-counter) << endl;
} else {
cout << 0 << endl;
}
}
return 0;
}