-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path00416 LED Test.cpp
61 lines (58 loc) · 1.74 KB
/
00416 LED Test.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
using namespace std;
map <ll, string> dic{
{0, "YYYYYYN"}, {1, "NYYNNNN"}, {2, "YYNYYNY"},
{3, "YYYYNNY"}, {4, "NYYNNYY"}, {5, "YNYYNYY"},
{6, "YNYYYYY"}, {7, "YYYNNNN"}, {8, "YYYYYYY"},
{9, "YYYYNYY"}
};
int main(){
ios_base::sync_with_stdio(false);
cin.tie();
ll n;
while(cin >> n) {
if(n == 0) break;
vector <string> entry(n);
for(ll i = 0; i < n; i++) {
cin >> entry[i];
}
bool masterKey = false;
for(ll i = 9; i >= n - 1; i--) {
vector <ll> burned(7);
string s;
ll it = 0;
bool key = true;
for(ll j = i; j >= 0; j--) {
string led = dic[j];
string in = entry[it++];
for(ll k = 0; k < 7; k++) {
if((in[k] == 'Y') && (burned[k] == 1)) {
key = false;
break;
}
if(led[k] != in[k]) {
if(led[k] == 'N') {
key = false;
break;
}
else if(led[k] == 'Y') {
burned[k] = 1;
}
}
}
if(key == false) break;
if(it == n) break;
}
if(key == true) {
masterKey = true;
cout << "MATCH" << endl;
break;
}
}
if(masterKey == false) {
cout << "MISMATCH" << endl;
}
}
}