#include <iostream>
#include <vector>
using namespace std;
int n, a;
int c,d,e,f,g,h,j,k,l,m,o,p,r,s,t;
char b;
int main()
{
vector <pair<int,char> > V;
cin >> n;
for (int i=0; i<n; ++i)
{
cin >> a >> b;
V.push_back(make_pair(a,b));
}
for (int i=0; i<V.size(); ++i)
{
if (V[i].first==1&&V[i].second=='A') c++;
if (V[i].first==1&&V[i].second=='B') d++;
if (V[i].first==1&&V[i].second=='C') e++;
if (V[i].first==2&&V[i].second=='A') f++;
if (V[i].first==2&&V[i].second=='B') g++;
if (V[i].first==2&&V[i].second=='C') h++;
if (V[i].first==3&&V[i].second=='A') j++;
if (V[i].first==3&&V[i].second=='B') k++;
if (V[i].first==3&&V[i].second=='C') l++;
if (V[i].first==4&&V[i].second=='A') m++;
if (V[i].first==4&&V[i].second=='B') o++;
if (V[i].first==4&&V[i].second=='C') p++;
if (V[i].first==5&&V[i].second=='A') r++;
if (V[i].first==5&&V[i].second=='B') s++;
if (V[i].first==5&&V[i].second=='C') t++;
}
if (c>=1)
{
if (d>=1)
{
if (e>=1)
{
if (f>=1)
{
if (g>=1)
{
if (h>=1)
{
if (j>=1)
{
if (k>=1)
{
if (l>=1)
{
if (m>=1)
{
if (o>=1)
{
if (p>=1)
{
if (r>=2)
{
if (s>=2)
{
if (t>=2) {cout <<"TAK";
return 0;}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
cout <<"NIE";
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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | #include <iostream> #include <vector> using namespace std; int n, a; int c,d,e,f,g,h,j,k,l,m,o,p,r,s,t; char b; int main() { vector <pair<int,char> > V; cin >> n; for (int i=0; i<n; ++i) { cin >> a >> b; V.push_back(make_pair(a,b)); } for (int i=0; i<V.size(); ++i) { if (V[i].first==1&&V[i].second=='A') c++; if (V[i].first==1&&V[i].second=='B') d++; if (V[i].first==1&&V[i].second=='C') e++; if (V[i].first==2&&V[i].second=='A') f++; if (V[i].first==2&&V[i].second=='B') g++; if (V[i].first==2&&V[i].second=='C') h++; if (V[i].first==3&&V[i].second=='A') j++; if (V[i].first==3&&V[i].second=='B') k++; if (V[i].first==3&&V[i].second=='C') l++; if (V[i].first==4&&V[i].second=='A') m++; if (V[i].first==4&&V[i].second=='B') o++; if (V[i].first==4&&V[i].second=='C') p++; if (V[i].first==5&&V[i].second=='A') r++; if (V[i].first==5&&V[i].second=='B') s++; if (V[i].first==5&&V[i].second=='C') t++; } if (c>=1) { if (d>=1) { if (e>=1) { if (f>=1) { if (g>=1) { if (h>=1) { if (j>=1) { if (k>=1) { if (l>=1) { if (m>=1) { if (o>=1) { if (p>=1) { if (r>=2) { if (s>=2) { if (t>=2) {cout <<"TAK"; return 0;} } } } } } } } } } } } } } } cout <<"NIE"; return 0; } |
English