//Marcin Wróbel #include <bits/stdc++.h> #define FOR(i,x,y) for(int i = (int)(x); i < (int)(y); ++i) #define FORE(i,x,y) for(int i = (int)(x); i <= (int)(y); ++i) #define FORD(i,x,y) for(int i = (int)(x); i >= (int)(y); --i) using namespace std; int res[10][4]; int main() { ios_base::sync_with_stdio(false);cin.tie(0); int n; cin>>n; while (n--) { string s; cin>>s; ++res[s[0]-'0'][s[1]-'A']; } FORE(i,1,4) { FOR(j,0,3) { if (res[i][j] < 1) { cout<<"NIE\n"; return 0; } } } FOR(j,0,3) { if (res[5][j] < 2) { cout<<"NIE\n"; return 0; } } cout<<"TAK\n"; return 0; } /* 18 1A 1B 1C 2A 2B 2C 3A 3B 3C 4A 4B 4C 5A 5B 5C 5A 5B 5C */
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 | //Marcin Wróbel #include <bits/stdc++.h> #define FOR(i,x,y) for(int i = (int)(x); i < (int)(y); ++i) #define FORE(i,x,y) for(int i = (int)(x); i <= (int)(y); ++i) #define FORD(i,x,y) for(int i = (int)(x); i >= (int)(y); --i) using namespace std; int res[10][4]; int main() { ios_base::sync_with_stdio(false);cin.tie(0); int n; cin>>n; while (n--) { string s; cin>>s; ++res[s[0]-'0'][s[1]-'A']; } FORE(i,1,4) { FOR(j,0,3) { if (res[i][j] < 1) { cout<<"NIE\n"; return 0; } } } FOR(j,0,3) { if (res[5][j] < 2) { cout<<"NIE\n"; return 0; } } cout<<"TAK\n"; return 0; } /* 18 1A 1B 1C 2A 2B 2C 3A 3B 3C 4A 4B 4C 5A 5B 5C 5A 5B 5C */ |