#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = a; i<b; ++i)
#define FR(a, b) for(int i = a; i>=b;--i)
#define _upgrade cin.tie(0); ios_base::sync_with_stdio(0)
#define pb push_back
#define mp make_pair
#define INF 1e9
using namespace std;
typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef pair<int, int> iPair;
const int MAX = 1e6 + 2;
const int M = 1e9 +7;
int n, tab[5][3];
int main()
{
_upgrade;
cin>>n;
FOR(i, 0, n)
{
char aa, bb;
cin>>aa>>bb;
int a = aa-'0'-1, b = bb-'A';
tab[a][b]++;
}
bool f = 1;
FOR(i, 0, 4)
FOR(j, 0, 3)
if(tab[i][j] == 0)f = 0;
FOR(i, 0, 3)
if(tab[4][i] < 2)f = 0;
if(f)
cout<<"TAK\n";
else
cout<<"NIE\n";
}
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 | #include <bits/stdc++.h> #define FOR(i, a, b) for(int i = a; i<b; ++i) #define FR(a, b) for(int i = a; i>=b;--i) #define _upgrade cin.tie(0); ios_base::sync_with_stdio(0) #define pb push_back #define mp make_pair #define INF 1e9 using namespace std; typedef long long ll; typedef double db; typedef unsigned long long ull; typedef pair<int, int> iPair; const int MAX = 1e6 + 2; const int M = 1e9 +7; int n, tab[5][3]; int main() { _upgrade; cin>>n; FOR(i, 0, n) { char aa, bb; cin>>aa>>bb; int a = aa-'0'-1, b = bb-'A'; tab[a][b]++; } bool f = 1; FOR(i, 0, 4) FOR(j, 0, 3) if(tab[i][j] == 0)f = 0; FOR(i, 0, 3) if(tab[4][i] < 2)f = 0; if(f) cout<<"TAK\n"; else cout<<"NIE\n"; } |
English