#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define st first
#define nd second
#define pii pair<int,int>
#define mp make_pair
#define pll pair<long long,long long>
using namespace std;
int jest[25];
int main()
{
int n; cin>>n;
bool ok = true;
while(n--)
{
char x,d; cin>>x>>d;
int pos = (x - '1') * 3 + (d - 'A' + 1);
jest[pos]++;
}
for(int i=1;i<=12;i++)
{
if(jest[i] == 0) ok = false;
}
for(int i=13;i<=15;i++)
{
if(jest[i] < 2) ok = false;
}
if(ok) 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 | #include <bits/stdc++.h> #define ll long long int #define pb push_back #define st first #define nd second #define pii pair<int,int> #define mp make_pair #define pll pair<long long,long long> using namespace std; int jest[25]; int main() { int n; cin>>n; bool ok = true; while(n--) { char x,d; cin>>x>>d; int pos = (x - '1') * 3 + (d - 'A' + 1); jest[pos]++; } for(int i=1;i<=12;i++) { if(jest[i] == 0) ok = false; } for(int i=13;i<=15;i++) { if(jest[i] < 2) ok = false; } if(ok) cout<<"TAK"<<"\n"; else cout<<"NIE"<<"\n"; return 0; } |
English