#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> iPair; typedef pair<ll,ll> llPair; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<iPair> viP; const int inf=0x3f3f3f3f; const ll INF=0x3f3f3f3f3f3f3f3f; const int modulo = 1e9 + 7; #define forr(i, b, e) for (int i = b; i < e; ++i) #define ford(i, b, e) for (int i = b; i >= e; --i) #define fort(i, x) for (auto &i : (x)) #define sze(x) ((int)x.size()) #define pb push_back #define mp make_pair #define st first #define nd second #define sp <<" " #define spa <<" "<< #define el <<"\n" int n; int tab[5][3]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; forr(i, 0, n) { char a,b; cin >> a >> b; b -= 'A'; tab[int(a - '1')][int(b)]++; } bool res = 1; forr(i, 0, 5) { if (i == 4){ if (tab[i][0] < 2 || tab[i][1] < 2 || tab[i][2] < 2) res = 0; } else { if (tab[i][0] < 1 || tab[i][1] < 1 || tab[i][2] < 1) res = 0; } } if (res) cout << "TAK\n"; else cout << "NIE\n"; return 0; }
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 | #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> iPair; typedef pair<ll,ll> llPair; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<iPair> viP; const int inf=0x3f3f3f3f; const ll INF=0x3f3f3f3f3f3f3f3f; const int modulo = 1e9 + 7; #define forr(i, b, e) for (int i = b; i < e; ++i) #define ford(i, b, e) for (int i = b; i >= e; --i) #define fort(i, x) for (auto &i : (x)) #define sze(x) ((int)x.size()) #define pb push_back #define mp make_pair #define st first #define nd second #define sp <<" " #define spa <<" "<< #define el <<"\n" int n; int tab[5][3]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; forr(i, 0, n) { char a,b; cin >> a >> b; b -= 'A'; tab[int(a - '1')][int(b)]++; } bool res = 1; forr(i, 0, 5) { if (i == 4){ if (tab[i][0] < 2 || tab[i][1] < 2 || tab[i][2] < 2) res = 0; } else { if (tab[i][0] < 1 || tab[i][1] < 1 || tab[i][2] < 1) res = 0; } } if (res) cout << "TAK\n"; else cout << "NIE\n"; return 0; } |